Skip to content

Instantly share code, notes, and snippets.

@tyrotinal
Created May 7, 2013 05:02
Show Gist options
  • Save tyrotinal/5530355 to your computer and use it in GitHub Desktop.
Save tyrotinal/5530355 to your computer and use it in GitHub Desktop.
railsHowto: set different layout for different controller
##Layout for different controllers
`app/controllers/dashboard_controller.rb`
class DashboardController < ApplicationController
before_filter :authenticate_user!
def index
render :layout => "dashboard"
end
end
and include the layout in the views folder:
`app/views/layouts/dashboard.html.erb`
<!DOCTYPE html>
<html>
<head>
<title>Yor title of the site</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/png" href="<%= asset_path 'fav.png' %>"
</head>
<body>
<%= yield %>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment