How to detect if rails is at the root url?

后端 未结 1 801
北荒
北荒 2020-12-14 06:03

What I want is seems simple.

In my application helper i setup this

module ApplicationHelper

def isroot
if root_url 
@container = \"mainbox\"
else
@c         


        
相关标签:
1条回答
  • 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)
    
    0 讨论(0)
提交回复
热议问题