pzin
pzin

Reputation: 4248

Rails: secondary layout

I started my first serious rails app. I'm building a site which will need for a specific model another structure as the application.html.erb. I'd like to have a general layout or structure as application.html.erb but for my, lets say, articles model, and then =yield any view of that model there.

Thanks in advance.

Upvotes: 0

Views: 110

Answers (2)

Helio Santos
Helio Santos

Reputation: 6805

You can use the keyword layout to override the default layout conventions in your controllers.

following your example:

class ArticlesController < ApplicationController
  layout 'articles_layout'
  ...
end

Upvotes: 2

Related Questions