I did the following: script/generate controller admin/products In my layout.rhtml template I want to use the admin style sheet. How can I tell if I am in the admin directory? controller.controller_name and controller.controller_class_name do not help at all, they don''t have admin anywhere in them. Thanks for your help. -- 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 -~----------~----~----~----~------~----~------~--~---
Ben Johnson wrote:> I did the following: > > script/generate controller admin/products > > In my layout.rhtml template I want to use the admin style sheet. How can > I tell if I am in the admin directory? > > controller.controller_name and controller.controller_class_name do not > help at all, they don''t have admin anywhere in them. > > Thanks for your help.Is there anything within the request object that will tell me I''m in the admin module / directory? -- 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 -~----------~----~----~----~------~----~------~--~---
Julio Espinoza-Sokal
2007-Jan-30 14:50 UTC
Re: How to tell if you are in a controller module
Try controller.controller_path. It should give you ''admin/products''. Julio On 1/30/07, Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ben Johnson wrote: > > I did the following: > > > > script/generate controller admin/products > > > > In my layout.rhtml template I want to use the admin style sheet. How can > > I tell if I am in the admin directory? > > > > controller.controller_name and controller.controller_class_name do not > > help at all, they don''t have admin anywhere in them. > > > > Thanks for your help. > > Is there anything within the request object that will tell me I''m in the > admin module / directory? > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Or you can just to params[''controller''] in your layout .rhtml page and it should give you "admin" On 1/29/07, Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I did the following: > > script/generate controller admin/products > > In my layout.rhtml template I want to use the admin style sheet. How can > I tell if I am in the admin directory? > > controller.controller_name and controller.controller_class_name do not > help at all, they don''t have admin anywhere in them. > > Thanks for your help. > > -- > 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 -~----------~----~----~----~------~----~------~--~---