Module layout

Hi

My Rails application is in fact a big application that includes many websites.

I have splitted each website into a module (wich includes the differents controllers of each websites).

Do you think it's the best way to do this ?

But I have a problem with layouts. I'd like to have a global layout for each website, and into each website to have a layout for all controllers.

Is it possible to have a " module layout" ?

I've another question:

I ve read in the french version of "agile web developement with rails" that the default layout for controller "my_controller" is the file "my_controller_layout.rhtml" located in "views/layout"

but I think the file must be named " my_controller.rhtml" ...

is that correct ?

I ll try to reply to me myself :wink:

I think it's not possible to have a " module layout" so I tried this method:

I have an application layout calling a partial format like this :

<%= render(:partial => "shared/"+@website, :object => @content_for_layout)%>

(website define the module (=website) of the controller of the action which must be rendered)

With this trick I can have

- an application format for all controllers of my applications - a "module partial format" for each modules (= each websites of my application) - a format for each actions

Do you have a better way of doing this ?

Thanks a lot

Cédric H. wrote:

If your controllers derive from application.rb then they share the application.rhtml layout. To have module level layouts you create a base_controller.rb in the module and derive all that modules controllers from base. In base you specify

layout 'modulex'

to use the modulex.rhtml layout. However that overrides the use of application.rhtml layout