szimek
2008-Jul-07 18:42 UTC
How to redirect back from action called from multiple controllers?
Hi, I''ve got a model i.e. Ticket, which has it''s own edit page. There''s also i.e. Report controller which has a view where I can edit i.e. one field of Ticket and Project controller where I can edit other field of Ticket object. The question is: how to use only one update method in Ticket controller and write redirect part in a simple way, so it will redirect back to the action from which it was called (or execute some rjs)? Should I send some additional parameter or use HTTP_REFERER and make case statement for redirecting/rendering rjs? Is there some simpler way? Regards --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-07 19:15 UTC
Re: How to redirect back from action called from multiple controllers?
On Jul 7, 7:42 pm, szimek <szi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Should I send some additional parameter or use HTTP_REFERER and make > case statement for redirecting/rendering rjs? Is there some simpler > way? >redirect_to :back will do the referrer thing for you. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
szimek
2008-Jul-07 19:28 UTC
Re: How to redirect back from action called from multiple controllers?
On 7 Lip, 21:15, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 7, 7:42 pm, szimek <szi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > > Should I send some additional parameter or use HTTP_REFERER and make > > case statement for redirecting/rendering rjs? Is there some simpler > > way? > > redirect_to :back will do the referrer thing for you. > > FredThanks. This will work for html, s half of the problem is gone :) But what about ajax request where I need to render specific rjs file? --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---