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 Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2 Jul 2008, at 06:44, Sijo Kg wrote:> > 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 happensIt''s probably to do with the bit of create you''ve removed. Fred> > > 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 > > Thanks in advance > Sijo > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Why can''t you just put the create_and_give_resolution code inside the create? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2 Jul 2008, at 07:54, Sijo Kg wrote:> > 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 itfactor out the common code into a function you call from both create and create_and_give resolution. Fred> > > > Sijo > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---