Skip to content

Instantly share code, notes, and snippets.

@lisasy
Last active August 29, 2015 13:57
Show Gist options
  • Save lisasy/9772466 to your computer and use it in GitHub Desktop.
Save lisasy/9772466 to your computer and use it in GitHub Desktop.
Nested application layouts for Rails projects
!!!
%html
%head
%meta{:charset => "utf-8"}
%meta{:content => "NOODP", :name => "ROBOTS"}
%meta{name: 'viewport', content: 'width=device-width; initial-scale=1.0; maximum-scale=1.0;'}
%title= page_title
= stylesheet_link_tag :application, :media => 'all'
= csrf_meta_tags
%body{:class => body_class}
- if content_for?(:banner)
= yield :banner
%section.container
= render 'flashes'
= yield
= render 'shared/footer'
= content_for :banner do
= render 'shared/banner'
= render template: 'application'
class PagesController < ApplicationController
include HighVoltage::StaticPage
before_filter :check_for_current_user
layout :landing_layout
private
def landing_layout
case params[:id]
when 'home'
'landing'
else
'application'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment