Gesen
2006-Nov-01 22:39 UTC
controller.controller_name for the controller name. But how do I write to get the current ID?
Hi everyone, To display the current controller name in a view template you can write <%= controller.controller_name %>. How do you write if you want to display the current ID parameter in a URL like this /pages/show/1? Many thanks for any answer! -G --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Gesen
2006-Nov-01 22:51 UTC
Re: controller.controller_name for the controller name. But how do I write to get the current ID?
Ahh, that was easy, thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2006-Nov-01 22:56 UTC
Re: controller.controller_name for the controller name. But how do I write to get the current ID?
> To display the current controller name in a view template you can write > <%= controller.controller_name %>. > How do you write if you want to display the current ID parameter in a > URL like this /pages/show/1?<%= params[:id] %> Assuming that''s what you called it in your route. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---