48

What I want is seems simple.

In my application helper i setup this

module ApplicationHelper

def isroot
if root_url 
@container = "mainbox"
else
@container = "maincontainerbox"
end
end
end

in my application layout i have this

 <div id="<%= isroot %>">

How do I find out if my application is at the homepage. if not do something else.

jerhinesmith
  • 15,214
  • 17
  • 62
  • 89
Fresh
  • 757
  • 1
  • 7
  • 18

1 Answers1

117

To test if you are at the site root:

current_page?('/')

or, if you defined map.root in your config/routes.rb:

current_page?(root_url)
Alex Reisner
  • 29,124
  • 6
  • 56
  • 53