How to detect if rails is at the root url?

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)