Hello, I am developing a RubyOnRails application and need to apply a layout dinamically to my controllers. The thing is I have 2 diferent layouts and, in function of a parameters retreived from the database when the page is loaded, I need my controllers to use on or the other of the two layouts. So I am looking for a way to do something like that: class MyController < ApplicationController layout "#{session[:layout]}" ... end Anyone know how I can do solve this? Olivier. -- 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.
On Apr 9, 5:35 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, I am developing a RubyOnRails application and need to apply a > layout dinamically to my controllers. The thing is I have 2 diferent > layouts and, in function of a parameters retreived from the database > when the page is loaded, I need my controllers to use on or the other > of the two layouts.Take a look at the docs for layout - you can supply a method that decides which layout to use. Fred -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello Fred, Yeah I guess there is a way to do it but I didn''t find anything with google...You have any link I could check? Thanks a lot. On 9 abr, 11:44, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 9, 5:35 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, I am developing a RubyOnRails application and need to apply a > > layout dinamically to my controllers. The thing is I have 2 diferent > > layouts and, in function of a parameters retreived from the database > > when the page is loaded, I need my controllers to use on or the other > > of the two layouts. > > Take a look at the docs for layout - you can supply a method that > decides which layout to use. > > Fred-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sorry, I finaly did find something :) http://apidock.com/rails/ActionController/Layout/ClassMethods/layout On 9 abr, 12:34, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Fred, > > Yeah I guess there is a way to do it but I didn''t find anything with > google...You have any link I could check? > > Thanks a lot. > > On 9 abr, 11:44, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Apr 9, 5:35 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hello, I am developing a RubyOnRails application and need to apply a > > > layout dinamically to my controllers. The thing is I have 2 diferent > > > layouts and, in function of a parameters retreived from the database > > > when the page is loaded, I need my controllers to use on or the other > > > of the two layouts. > > > Take a look at the docs for layout - you can supply a method that > > decides which layout to use. > > > Fred- Ocultar texto de la cita - > > - Mostrar texto de la cita --- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.