【问题标题】:Rails 3 current_page unexpected behaviorRails 3 current_page 意外行为
【发布时间】:2012-03-08 14:46:58
【问题描述】:


我不知道怎么想...
在 routes.rb 我有一条路线:

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

我参与了/profile 行动。

params.inspect 给了我 {"action"=>"index", "controller"=>"profile"}

我不知道为什么要 current_page?(:controller => 'profile', :action => "index" )false

非常感谢。

【问题讨论】:

    标签: ruby-on-rails html-helper


    【解决方案1】:

    试试这个:

    current_page?(profile_path)
    

    最好使用 url 帮助程序,而不是在代码中指定控制器和操作。

    【讨论】:

    • 求救。但是 current_page?(profile_path) 也返回 false。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-10
    • 1970-01-01
    • 1970-01-01
    • 2017-04-20
    • 2011-04-16
    • 1970-01-01
    相关资源
    最近更新 更多