【问题标题】:Rails 3.2.6 DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => 'Text' }0Rails 3.2.6 弃用警告::confirm 选项已弃用,将从 Rails 4.0 中删除。使用 ':data => { :confirm => 'Text' }0
【发布时间】:2012-06-25 22:16:46
【问题描述】:

这是在我将应用程序从 Rails 3.2.3 升级到 3.2.6 后开始出现的警告。这是我的“数据表”相关类中指向的代码行:

class PdpsDatatable
  delegate :current_user, :is_reader?, :is_admin?, :is_user?, :show_num, :params, :h, :link_to, to: :@view
  # the line above is what the warning is pointing to
end

这个警告有什么简单的解决方法吗?实在是太烦人了。

谢谢。

巴拉特

【问题讨论】:

    标签: ruby-on-rails warnings deprecated


    【解决方案1】:

    我认为问题不在这一行....您可能在应用程序的其他地方有:confirm,例如button_tobutton_tagimage_submit_taglink_to 或@ 987654328@.

    有关此弃用的更多详细信息here

    此警告here 的可能解决方案。

    【讨论】:

    • 这确实在 link_to 函数中。谢谢指点。
    • 在我的情况下(rails 3.2.7),弃用警告准确地指向了我的 index 视图中的确切行,link_tos 和 confirm: 'Are you sure?'(顺便说一句,所有的都是 method: :delete )。事实上,用:data => { :confirm => 'Are you sure?' } 替换就可以了。
    猜你喜欢
    • 1970-01-01
    • 2017-05-25
    • 2017-08-02
    • 2017-03-08
    • 2014-06-13
    • 2016-12-07
    • 2020-10-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多