ruby on rails 5.1 error with devise gem

时间:2017-05-01 09:20:09

标签: ruby-on-rails devise rubygems

当我尝试运行时:' rails generate devise:install'

我得到以下内容:

`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`

我的Gemfile:     来源' https://rubygems.org'

gem 'devise'
gem 'rails', '~> 5.1.0'
gem 'sqlite3'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'capybara', '~> 2.13.0'
  gem 'selenium-webdriver'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

3 个答案:

答案 0 :(得分:9)

根据https://github.com/plataformatec/devise/issues/4518 Devise 4.0不适用于Rails 5.1.0

下周将有一个新版本,同时在你的Gemfile中你可以使用: gem "devise", git: 'https://github.com/plataformatec/devise.git'

答案 1 :(得分:0)

如果您正在寻找使用Devise 4.3的Rails应用程序(5.1.2)的副本,我会分叉rails-devise repo。

https://github.com/ytbryan/rails-devise

此repo也使用Ruby 2.4.0和Pg 0.20.0

答案 2 :(得分:0)

确保Gemfile中包含以下几行

    SyntaxError: invalid syntax
  File "<command-1632344621139040>", line 10
    StructField('PCBA Serial Number',StringType,True),
              ^
SyntaxError: invalid syntax

然后运行gem 'devise', github: 'plataformatec/devise' gem 'erubis'