Rails Check If Current Page is Home

As Ruby On Rails developer, someday I need to display an element in home page only. However I don't want to display it on other page. So I need to check if current page is home or not. To check if current page is home or not, I use the following codes

The code above will return a hash data type as follow:

{:action => 'current_action', :controller => 'current_controller'}
If the current page is your Rails application homepage, then the hash data type above will be like this one (in almost case including mine).

{:action => 'index', :controller => 'public'}
I suggest you to check it first to make sure which action and controller that serves for your homepage on your Rails application.
Please notice that we can use the request.path_parameters on view. I do it and it solves my problem. After that, you can use it in if-then-else condition as usual.