Dinamic layout

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.

On Apr 9, 5:35 pm, CiriusMex [email protected] 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

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.

Sorry, I finaly did find something :slight_smile:
http://apidock.com/rails/ActionController/Layout/ClassMethods/layout