Hello! Is it just me or are layouts not namespaced automatically? For example, using the typical namespaced admin section, I have: apps/controllers/admin/users_controller.rb # for example apps/views/admin/users/index.html.erb I then added this: apps/views/admin/layouts/application.html.erb But it won''t use that layout... it''s looking for: apps/views/layouts/application.html.erb Why are views namespaced but layouts aren''t? There are lots of "solutions" to this, I know, but I''m trying to understand why Rails won''t look at "apps/views/admin/layouts/" for layouts within the admin namespace? Or maybe I''m missing something? Thanks, -Danimal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Somewhat of an answer, somewhat of a new question... It looks like layouts use namespacing, but "backwards" from everything else. In other words, given my namespaced "admin", It would look for layouts in: apps/views/layouts/admin/whatever.html.erb I''m wondering why that way and not: apps/views/admin/layouts/whatever.html.erb The advantage to the latter would be that layouts and views would all "live" under the admin folder. Ahh well. Any insight on the why? I.e. why it is this way? -Danimal On Sep 10, 8:48 am, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello! > > Is it just me or are layouts not namespaced automatically? > > For example, using the typical namespaced admin section, I have: > > apps/controllers/admin/users_controller.rb # for example > apps/views/admin/users/index.html.erb > > I then added this: > apps/views/admin/layouts/application.html.erb > > But it won''t use that layout... it''s looking for: > apps/views/layouts/application.html.erb > > Why are views namespaced but layouts aren''t? There are lots of > "solutions" to this, I know, but I''m trying to understand why Rails > won''t look at "apps/views/admin/layouts/" for layouts within the admin > namespace? > > Or maybe I''m missing something? > > Thanks, > > -Danimal--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
My guess is that layouts span across controllers and views...aka namespaces. I have one layout for my entire app mostly. And where I have another layout is for public pages, but these layout are in no way controller specific. Thou I do see apps where this makes sense. Ray On Sep 10, 1:10 pm, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Somewhat of an answer, somewhat of a new question... > > It looks like layouts use namespacing, but "backwards" from everything > else. In other words, given my namespaced "admin", It would look for > layouts in: > > apps/views/layouts/admin/whatever.html.erb > > I''m wondering why that way and not: > > apps/views/admin/layouts/whatever.html.erb > > The advantage to the latter would be that layouts and views would all > "live" under the admin folder. Ahh well. > > Any insight on the why? I.e. why it is this way? > > -Danimal > > On Sep 10, 8:48 am, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello! > > > Is it just me or are layouts not namespaced automatically? > > > For example, using the typical namespaced admin section, I have: > > > apps/controllers/admin/users_controller.rb # for example > > apps/views/admin/users/index.html.erb > > > I then added this: > > apps/views/admin/layouts/application.html.erb > > > But it won''t use that layout... it''s looking for: > > apps/views/layouts/application.html.erb > > > Why are views namespaced but layouts aren''t? There are lots of > > "solutions" to this, I know, but I''m trying to understand why Rails > > won''t look at "apps/views/admin/layouts/" for layouts within the admin > > namespace? > > > Or maybe I''m missing something? > > > Thanks, > > > -Danimal--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The application layout is for the entire application and it doesn''t care about what namespace you''re in. If you really wanted a different layout you could use the layout method in your controller to tell it which one you want. ----- Ryan Bigg Freelancer Skype: radarlistener MSN & Gtalk: radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 11/09/2008, at 10:00 PM, Ray wrote:> > My guess is that layouts span across controllers and views...aka > namespaces. I have one layout for my entire app mostly. And where I > have another layout is for public pages, but these layout are in no > way controller specific. Thou I do see apps where this makes sense. > > Ray > > On Sep 10, 1:10 pm, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Somewhat of an answer, somewhat of a new question... >> >> It looks like layouts use namespacing, but "backwards" from >> everything >> else. In other words, given my namespaced "admin", It would look for >> layouts in: >> >> apps/views/layouts/admin/whatever.html.erb >> >> I''m wondering why that way and not: >> >> apps/views/admin/layouts/whatever.html.erb >> >> The advantage to the latter would be that layouts and views would all >> "live" under the admin folder. Ahh well. >> >> Any insight on the why? I.e. why it is this way? >> >> -Danimal >> >> On Sep 10, 8:48 am, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Hello! >> >>> Is it just me or are layouts not namespaced automatically? >> >>> For example, using the typical namespaced admin section, I have: >> >>> apps/controllers/admin/users_controller.rb # for example >>> apps/views/admin/users/index.html.erb >> >>> I then added this: >>> apps/views/admin/layouts/application.html.erb >> >>> But it won''t use that layout... it''s looking for: >>> apps/views/layouts/application.html.erb >> >>> Why are views namespaced but layouts aren''t? There are lots of >>> "solutions" to this, I know, but I''m trying to understand why Rails >>> won''t look at "apps/views/admin/layouts/" for layouts within the >>> admin >>> namespace? >> >>> Or maybe I''m missing something? >> >>> Thanks, >> >>> -Danimal > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---