Richlewis
Richlewis

Reputation: 15374

Multiple shared footers in Rails 3

Is there a way of rendering different shared footers in rails, so for example i would like one footer for the homepage and then a different footer throughout the site.

has anyone done this before? i was thinking that an if statement would work depending upon the page viewed? not sure if this is correct

Any help appreciated

Upvotes: 0

Views: 58

Answers (1)

Larsenal
Larsenal

Reputation: 51156

If you had the following layouts:

  • app/views/layouts/application.html.erb
  • app/views/layouts/home.html.erb

You'd just specify the layout in your homepage controller as in

class HomeController < ApplicationController
  layout 'home'
  #everything else follows...
end

The rest of your views will use the default, which is application.html.erb.

Upvotes: 1

Related Questions