简体   繁体   中英

Rails 3 current_page unexpected behavior


I don't what to think...
In routes.rb I have a route:

match 'profile' => 'profile#index', :via => :get

I am in the /profile action.

params.inspect gives me {"action"=>"index", "controller"=>"profile"}

I don't know Why Doed current_page?(:controller => 'profile', :action => "index" ) give false ?

Thanks a lot.

Try this:

current_page?(profile_path)

It's always better to use the url helpers rather than specifying controllers and actions in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM