Hey Right now, I have a lot of controllers/views Half of them require one type of layout, the other half requires another type of layout. right now, the first half of my views uses the application.html.erb Now, there are another bunch of views. How can I assign them all to application2.html.erb?? I don''t want to assign a seperate layout for each of the controllers, and application.html.erb is already used. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hi, i know in controller ,use layout ''application2'' can change default layout. 2010/5/14 David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> Hey > > Right now, I have a lot of controllers/views > > Half of them require one type of layout, the other half requires > another type of layout. > > right now, the first half of my views uses the application.html.erb > > Now, there are another bunch of views. How can I assign them all to > application2.html.erb?? > > I don''t want to assign a seperate layout for each of the controllers, > and application.html.erb is already used. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- tommy xiao E-mail: xiaods(AT)gmail.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
more guide: http://guides.rubyonrails.org/layouts_and_rendering.html#using-nested-layouts 2010/5/14 tommy xiao <xiaods-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> hi, > i know in controller ,use > > layout ''application2'' > can change default layout. > > > 2010/5/14 David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > Hey >> >> Right now, I have a lot of controllers/views >> >> Half of them require one type of layout, the other half requires >> another type of layout. >> >> right now, the first half of my views uses the application.html.erb >> >> Now, there are another bunch of views. How can I assign them all to >> application2.html.erb?? >> >> I don''t want to assign a seperate layout for each of the controllers, >> and application.html.erb is already used. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > > -- > tommy xiao > E-mail: xiaods(AT)gmail.com >-- tommy xiao E-mail: xiaods(AT)gmail.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi David, On Thu, May 13, 2010 at 7:16 PM, David Zhu <dzwestwindsor45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hey > > Right now, I have a lot of controllers/views > > Half of them require one type of layout, the other half requires > another type of layout. > > right now, the first half of my views uses the application.html.erb > > Now, there are another bunch of views. How can I assign them all to > application2.html.erb?? > > I don''t want to assign a seperate layout for each of the controllers, > and application.html.erb is already used. thanks >Assuming that your views / layouts are specific to controllers, one way to handle this is to have you controllers inherit from a ''child'' of ApplicationController Pseudocode follows. ApplicationControllerForLayoutOne << ApplicationController layout :layout1 end OneController < ApplicationControllerForLayoutOne end ApplicationControllerForLayoutTwo << ApplicationController layout :layout2 end AnotherController < ApplicationControllerForLayoutTwo end HTH, 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.