Hi
I already have a function
def create
#code here
end
It after execution call its view with same name..Now i have
another function create_and_give_resolution
This function is called from submit_to_remote In this function what I
need is to call the aboe create def and some other extra code..But when
I try like below nothing happens
def create_and_give_resolution
create
#code continues
render :update do |page|
page.redirect_to(:action => 'edit_sd_ticket_ui', :id => 43)
end
end
Is this because create tries to render its view?If I am not calling
create I get the desired result..Am I not trying in the right way?Please
help me to solve this
Hi
I already have a function
def create
#code here
end
It after execution call its view with same name..Now i have
another function create_and_give_resolution
This function is called from submit_to_remote In this function
what I
need is to call the aboe create def and some other extra code..But
when
I try like below nothing happens
It's probably to do with the bit of create you've removed.
I think i cudn't make you understand..I shall explain a bit more..Create
function is the function i already have And I am calling that function
from a view with link_to So now in addition to create I have to give a
resolution also.That I am calling by clicking another link which is a
submit_to_remote.So I created a seperate function
create_and_give_resolution..In that I just call create (to avoid
repitition) And after that add resolution and all(which is not needed in
the original create function) And then redirect_to another page..But
this did not work.Because the create function has a view with same and
at the bottom create def I am redirectiong as
redirect_to(:action => 'edit_sd_ticket_ui', :id =>
@service_desk_ticket.id)
So here I am in a situation to reuse the full code inside create
but not redirect to the action Rather came back to
create_and_give_resolution and executing remaing portion ...How can I do
this..I think now you got it
I think i cudn't make you understand..I shall explain a bit
more..Create
function is the function i already have And I am calling that function
from a view with link_to So now in addition to create I have to
give a
resolution also.That I am calling by clicking another link which is a
submit_to_remote.So I created a seperate function
create_and_give_resolution..In that I just call create (to avoid
repitition) And after that add resolution and all(which is not
needed in
the original create function) And then redirect_to another page..But
this did not work.Because the create function has a view with same and
at the bottom create def I am redirectiong as
redirect_to(:action => 'edit_sd_ticket_ui', :id =>
@service_desk_ticket.id)
So here I am in a situation to reuse the full code inside create
but not redirect to the action Rather came back to
create_and_give_resolution and executing remaing portion ...How can
I do
this..I think now you got it
factor out the common code into a function you call from both create
and create_and_give resolution.