Created
May 7, 2013 05:02
-
-
Save tyrotinal/5530355 to your computer and use it in GitHub Desktop.
railsHowto: set different layout for different controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##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