Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `alias_method_chain (Rails 5.1, ruby 2.4) #4511

Closed
imKota opened this issue Apr 28, 2017 · 16 comments
Closed

undefined method `alias_method_chain (Rails 5.1, ruby 2.4) #4511

imKota opened this issue Apr 28, 2017 · 16 comments

Comments

@imKota
Copy link

imKota commented Apr 28, 2017

gem 'devise'

error:

/Users/kota/.rvm/rubies/ruby-2.4.0/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/kota/Projects/Freya/bin/rails server -b 0.0.0.0 -p 3000 -e development
/Users/kota/.rvm/gems/ruby-2.4.0@Freya/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'. (Bundler::GemRequireError)
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:
@imKota
Copy link
Author

imKota commented Apr 28, 2017

fixed

add:

gem 'devise', git: 'https://github.com/gogovan/devise.git', branch: 'rails-5.1'
gem 'erubis'
bundle install

working for me.

@rafaelfranca
Copy link
Collaborator

rafaelfranca commented Apr 28, 2017

Could you try the master branch? It should be fixed there.

@klebershimabuku
Copy link

@rafaelfranca just tried the master branch with ruby 2.4.1 and rails 5.1 and it is not working.

Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    devise was resolved to 4.2.0, which depends on
      railties (< 5.1, >= 4.1.0)

    rails (~> 5.1.0) was resolved to 5.1.0, which depends on
      railties (= 5.1.0)

@klebershimabuku
Copy link

Sorry, my mistake, it is working!

@NickMoignard
Copy link

@imKota Thank you for taking the time to post your solution to the problem.
I had the same issue, and i have implemented your fix.

But. Would you be able to explain what is actually happening here?
What is special about 'gogovan/devise.git' and the 'erubis' gem?

Thank you in advance! 😄

@repocho007
Copy link

hola hablo español soy nuevo me gustaria que me ayudaran estoy instalando devise pero cuando coloco "rails g devise:install"
da resultado esto
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:85:in rescue in block (2 levels) in require': There was an error while trying to loa d the gem 'devise'. (Bundler::GemRequireError) 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:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:14:in <class:RouteSet>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in module:Routing'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in block in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails.rb:1:in <top (required)>'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in block in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise.rb:445:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:82:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:82:in block (2 levels) in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in each'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in block in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in each'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler.rb:108:in require'
C:/Users/admin/certificados/config/application.rb:7:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require_application_and_environment!' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands/generate/generate_command.rb:19:in perform'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in invoke_command'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/base.rb:63:in perform'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command.rb:44:in invoke' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands.rb:16:in <top (required)>'
bin/rails:4:in require' bin/rails:4:in

'
Bundler Error Backtrace:
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:81:in block (2 levels) in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in block in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler.rb:108:in require'
from C:/Users/admin/certificados/config/application.rb:7:in <top (required)>' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require_application_and_environment!' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands/generate/generate_command.rb:19:in perform'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in invoke_command'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/base.rb:63:in perform'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command.rb:44:in invoke' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands.rb:16:in <top (required)>'
from bin/rails:4:in require' from bin/rails:4:in '

C:\Users\admin\certificados>gem update bundlergem 'devise', git: 'https://github.com/gogovan/devise.git', branch: 'rails-5.1'
Updating installed gems
Nothing to update

C:\Users\admin\certificados>rails generate devise:install
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:85:in rescue in block (2 levels) in require': There was an error while trying to loa d the gem 'devise'. (Bundler::GemRequireError) 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:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:14:in <class:RouteSet>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in module:Routing'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in block in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise/rails.rb:1:in <top (required)>'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in block in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/devise-1.5.4/lib/devise.rb:445:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:82:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:82:in block (2 levels) in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in each'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in block in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in each'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in require' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler.rb:108:in require'
C:/Users/admin/certificados/config/application.rb:7:in <top (required)>' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require_application_and_environment!' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands/generate/generate_command.rb:19:in perform'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in invoke_command'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/base.rb:63:in perform'
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command.rb:44:in invoke' C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands.rb:16:in <top (required)>'
bin/rails:4:in require' bin/rails:4:in

'
Bundler Error Backtrace:
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:81:in block (2 levels) in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:77:in block in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler/runtime.rb:66:in require' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.0.pre.3/lib/bundler.rb:108:in require'
from C:/Users/admin/certificados/config/application.rb:7:in <top (required)>' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/actions.rb:15:in require_application_and_environment!' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands/generate/generate_command.rb:19:in perform'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in run' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in invoke_command'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in dispatch' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command/base.rb:63:in perform'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/command.rb:44:in invoke' from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.0/lib/rails/commands.rb:16:in <top (required)>'
from bin/rails:4:in require' from bin/rails:4:in '

@brightbytes-dude
Copy link

brightbytes-dude commented May 4, 2017

This fails for devise-async though:

Gemfile:

gem 'devise', git: 'https://github.com/gogovan/devise.git', branch: 'rails-5.1'
gem 'erubis'
gem 'devise-async'

Results:

Bundler could not find compatible versions for gem "devise":
  In Gemfile:
    devise

    devise-async was resolved to 0.5.1, which depends on
      devise (< 2.2.0, >= 1.1)

@imKota
Copy link
Author

imKota commented May 4, 2017

@NickMoignard Special? fixed version.
When installing devise, a dependency error appeared. What you need to install erubis. After installing 'gogovan/devise.git and erubis, it all worked for me.

Try the master branch.
#4518 (comment)

@zelgaliz
Copy link

zelgaliz commented May 5, 2017

@repocho007 Hola bro la solucion la dio imKota, igual es solo editar el archivo Gemfile dentro del proyecto y colocas:

gem 'devise', git: 'https://github.com/gogovan/devise.git', branch: 'rails-5.1'
gem 'erubis'

Luego en la consola ejecutas
bundle install

Y ya podras: rails g device:install

@repocho007
Copy link

Friend ya e solucionado
lo solucione con la desinstalacion del development e instalandolo depues de ello instale teniendo en cuenta el review despues de init seguido por install con ayuda de node y ruby main logre instalar todo lo faltante

@repocho007
Copy link

Zelgaliz veo que hablas español sera que me podrías colaborar con algunos asustos de unas gemas
ya que soy nuevo en el tema

@SylarRuby
Copy link

The master branch has the fix already.

@davida26
Copy link

davida26 commented May 9, 2017

Confirmed master branch working well!
gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master'

@brightbytes-dude
Copy link

Yup, confirmed. Thanks!!

@marjaimate
Copy link

@rafaelfranca is there any plan in which version will this be added - i.e. not just on the master branch, but bundled up to rubygems.org?

@shubhamsharma31
Copy link

shubhamsharma31 commented May 12, 2017

undefined method `alias_method_chain' for DeviseController:Class (NoMethodError) when we are using the devise version i.e gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master' in rails 5.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests