Hi there! What I need is know the action name which I am coming from. Best regards. Paco --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton
2008-Sep-11 13:59 UTC
Re: How to know the action (name) which I am coming from?
Hi Paco, paco.onrails wrote:> > What I need is know the action name which I am coming from.In your view, controller.controller_name and controller.action_name will tell you which controller or action your view''s being rendered from. Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Russell Norris
2008-Sep-11 14:55 UTC
Re: How to know the action (name) which I am coming from?
if you''re looking for the previous action, you could parse the controller/action names from request.referer. RSL On Thu, Sep 11, 2008 at 9:59 AM, Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org>wrote:> > Hi Paco, > > paco.onrails wrote: > > > > What I need is know the action name which I am coming from. > > In your view, controller.controller_name and controller.action_name will > tell you which controller or action your view''s being rendered from. > > Best regards, > Bill > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Leonardo David Gómez
2008-Sep-11 15:24 UTC
Re: How to know the action (name) which I am coming from?
Hi paco, try request.path_parameters. Best regards. Leonardo Gómez --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, request.path_parameters returns the current parameters, not the ones corresponding the previous action. I haven''t been able to find anything better yet than parsing request.referer or submiting the info through params. In my case, its an ajax request and i want to render one of various RJS templates, depending on the form that the user is currenly displaying. Any suggestions? Regards, Alberto. On 11 sep, 16:24, Leonardo David Gómez <ldg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi paco, try request.path_parameters. > > Best regards. > > Leonardo Gómez--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Perhaps a hidden input in each of the forms would be best? And then your Ajax method can render different templates based on that. -Brady On Sep 14, 3:52 pm, apm <alberto.perd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > request.path_parameters returns the current parameters, not the ones > corresponding the previous action. > I haven''t been able to find anything better yet than parsing > request.referer or submiting the info through params. > > In my case, its an ajax request and i want to render one of various > RJS templates, depending on the form that the user is currenly > displaying. > Any suggestions? > > Regards, > Alberto. > > On 11 sep, 16:24, Leonardo David Gómez <ldg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi paco, try request.path_parameters. > > > Best regards. > > > Leonardo Gómez--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes, I would suggest to use a hidden form field or a simple query string parameter for this purpose. Evaluating the referer is a risky business as users can disable this information in their browsers. This way you would need to implement a fallback scenario for these users. Max On Sep 15, 3:32 am, brady8 <bradybouch...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Perhaps a hidden input in each of the forms would be best? And then > your Ajax method can render different templates based on that. > > -Brady > > On Sep 14, 3:52 pm, apm <alberto.perd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > request.path_parameters returns the current parameters, not the ones > > corresponding the previous action. > > I haven''t been able to find anything better yet than parsing > > request.referer or submiting the info through params. > > > In my case, its an ajax request and i want to render one of various > > RJS templates, depending on the form that the user is currenly > > displaying. > > Any suggestions? > > > Regards, > > Alberto. > > > On 11 sep, 16:24, Leonardo David Gómez <ldg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi paco, try request.path_parameters. > > > > Best regards. > > > > Leonardo Gómez--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This sounds like an ideal time to use: 1. hidden fields to manage parameters (I use a from_type, and a from_id so I can route back to the appropriate form after a create or update - there are several routes that can create a "scenario" in my app, and I always want to route back to the model/view that the user is creating the scenario from, be it the index view for scenarios, or a specific parent project) 2. A "GenericController" class that sits between a specific model''s controller and ApplicationController. My GenericController implements all the standard (for my app at least) routing by examining the from_type and from_id parameters to determine where to redirect the user. It also handles the standard AR rescues as well. -- 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 -~----------~----~----~----~------~----~------~--~---
Michael Lavrisha
2008-Sep-15 20:31 UTC
Re: How to know the action (name) which I am coming from?
paco.onrails wrote:> Hi there! > > What I need is know the action name which I am coming from. > > Best regards. > > Pacocheckout request.env["HTTP_REFERER"]. I think it returns the url and you can then parse that data for the action. mike -- 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 -~----------~----~----~----~------~----~------~--~---