Alex Rivera | Logout

In rails is it possible to load class layout dynamically?

Asked 2009-08-13T22:33:23.213
10

I need message to have a different layout in project, is it possible in rails to do something like this?

Class Messages::New < @project? ProjectLayout : NormalLayout
end  #i treid this, don't work, since @project has not been initiated.

thanks

Edit
Report

1 Answer

1

You can only apply layouts at the Controller level:

class MessagesController < ApplicationController
  layout :project
end

Layout method documentation has an example on how to do conditional layouts

answered 2009-08-13T22:41:38.293

Your Answer