alias_method_chain修复了Devise with Rails 5 API?

时间:2015-10-12 02:49:21

标签: devise ruby-on-rails-5

Devise一直在给我这条消息DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <class:RouteSet> at /.../.rvm/gems/ruby-2.2.3/gems/devise-3.3.0/lib/devise/rails/routes.rb:27) 这就是Devise的routes.rb看起来像

module ActionDispatch::Routing
  class RouteSet #:nodoc:
    # Ensure Devise modules are included only after loading routes, because we
    # need devise_for mappings already declared to create filters and helpers.
    def finalize_with_devise!
      result = finalize_without_devise!

      @devise_finalized ||= begin
        if Devise.router_name.nil? && defined?(@devise_finalized) && self != Rails.application.try(:routes)
          warn "[DEVISE] We have detected that you are using devise_for inside engine routes. " \
            "In this case, you probably want to set Devise.router_name = MOUNT_POINT, where "   \
            "MOUNT_POINT is a symbol representing where this engine will be mounted at. For "   \
            "now Devise will default the mount point to :main_app. You can explicitly set it"   \
            " to :main_app as well in case you want to keep the current behavior."
        end

        Devise.configure_warden!
        Devise.regenerate_helpers!
        true
      end

      result
    end
    alias_method_chain :finalize!, :devise
  end

可以在这里快速修复吗?

2 个答案:

答案 0 :(得分:3)

设计发布候选版本支持Rails 5,将其放在ol'Gemfile

bool valid = words.All(w=>subjectarray.Contains(w) && verbarray.Contains(w));

答案 1 :(得分:1)

请检查以下内容:

1)这个要点包含Rails 5的routes.rb文件的更新代码

https://raw.githubusercontent.com/chbonser/devise/f05dd9dddb33cbc1739266637eafa2299661f517/lib/devise/rails/routes.rb

OR

2)使用终端获取gem文件夹路径:

gem environment

你应该得到路径,这将帮助你找到设计宝石文件夹。

浏览设计gem(类似这样):

cd /usr/local/rvm/gems/ruby-2.2.2/gems/devise-3.5.2/lib/devise

并编辑/更新文件,如failure_app.rb:

nano failure_app.rb

评论/删除RackDelegation参考:

https://github.com/plataformatec/devise/issues/3736