Devise: Rails 5.1 alias_method_chain undefined.

Created on 29 Apr 2017  ·  4Comments  ·  Source: heartcombo/devise

On a fresh test project I tried to do:
rails generate devise:install
and I was not able to do it because seems like there is no alias_method_chain in rails 5.1

I manually changed it to alias_method as suggested but more issues appear if you do that.

Oh, also I'm using Ruby 2.4.1.

Stack of the error:

home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise'.
Gem Load Error is: undefined method `alias_method_chain' for ActionDispatch::Routing::RouteSet:Class
Did you mean?  alias_method
Backtrace for gem load error is:
/home/lockon/.rvm/gems/ruby-2.4.1/gems/devise-1.5.4/lib/devise/rails/routes.rb:15:in `<class:RouteSet>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in `<module:Routing>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in `<top (required)>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/devise-1.5.4/lib/devise/rails.rb:1:in `<top (required)>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/devise-1.5.4/lib/devise.rb:445:in `<top (required)>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
/home/lockon/workspace/company_solution/config/application.rb:7:in `<top (required)>'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:82:in `require'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:82:in `preload'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
/home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
/home/lockon/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/lockon/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
Bundler Error Backtrace:
 (Bundler::GemRequireError)
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
    from /home/lockon/workspace/company_solution/config/application.rb:7:in `<top (required)>'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:82:in `require'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:82:in `preload'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
    from /home/lockon/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /home/lockon/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/lockon/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

Most helpful comment

Thank you for the report. Can you try the master branch? It is already fixed there.

All 4 comments

Thank you for the report. Can you try the master branch? It is already fixed there.

I had the same error in Rails 5.1. It's resolves when pointing my Gemfile to master :D

I will try that, thanks for the quick response!

how do you point gemfile to master?

Was this page helpful?
0 / 5 - 0 ratings