Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some sort of Master Page functionality in Ruby on Rails?

I've been a .Net developer for the past seven years or so, and been working with ASP.Net for the last couple of years. I'm now using Ruby on Rails for some projects, and I'm wanting to know if there is something in Ruby on Rails that lets you do master page type stuff?

Basically, I want a way to provide a consistent look and feel for the site with a header and footer and so on, and then just have each page put its content inside of that. How do you accomplish this?

like image 548
Max Schmeling Avatar asked Oct 23 '09 16:10

Max Schmeling


1 Answers

in your rails project in app/layouts/application.(html.erb|html.haml), this is the layout or equivalent for master. You can also create other layouts and specify the layout to use for each action :

render :index, :layout => "awesome"

Or specify the layout for a whole controller :

class PostController < ActionController::Base
  layout "super_awesome"
end
like image 50
Mike Avatar answered Oct 30 '22 12:10

Mike