current-page

Rails current_page? versus controller.controller_name

一世执手 提交于 2019-11-27 10:08:46
问题 I'm implementing current_page? in a view to test if the current controller and action is equal to a certain value, however it won't return true when on that controller/action combination. - if current_page?(:controller => 'pages', :action => 'main') # doesn't return true when on that controller/action combination The only way it is working is if I use a bit more verbose method like so: - if controller.controller_name == 'pages' && controller.action_name == 'main' # this works just fine Is my