Is there a way of extracing controller name from a URL? --~--~---------~--~----~------------~-------~--~----~ 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 don''t think so because the url could be completely different from the controller path because of routes. There''s ''controller.controller_name'' or ''controller.controller_path'' (http:// api.rubyonrails.org/classes/ActionController/Base.html#M000433) which you can use to figure which controller''s being used from within the app.. On Feb 7, 8:29 am, "Love AJAX" <lovea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is there a way of extracing controller name from a URL?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
My situation is slightly different. I want to look at request.env[''HTTP_REFERER''] and take a different action based on what is stored in it. For example if the URL belongs to controller a, then take one action and if its controller b then take a different action. On 2/7/08, idleFingers <mail-SuwyNEombvosXMjTw6Upulpr/1R2p/CL@public.gmane.org> wrote:> > I don''t think so because the url could be completely different from > the controller path because of routes. There''s > ''controller.controller_name'' or ''controller.controller_path'' (http:// > api.rubyonrails.org/classes/ActionController/Base.html#M000433) which > you can use to figure which controller''s being used from within the > app.. > > On Feb 7, 8:29 am, "Love AJAX" <lovea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Is there a way of extracing controller name from a URL? > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
params[:controller] will give you the controller name. params[:action] will give you the action name. -- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---