简体   繁体   English

尝试生成 devise 时出错:安装在 Ruby on Rails

[英]Error when trying to generate devise:install in Ruby on Rails

I'm a new to Ruby on Rails and I tried to do some examples from Inte.net.我是 Ruby on Rails 的新手,我尝试从 Inte.net 做一些例子。 But I have an error when I'm trying to generate devise install.但是当我尝试生成 devise 安装时出现错误。 I modified the Gemfile by adding gem devise .我通过添加gem devise 修改了 Gemfile Then run:然后运行:

bundle install

but when I run.但是当我跑的时候。

rails generate devise:install

I had the next error:我有下一个错误:

/usr/local/lib/ruby/gems/0.9.1/gems/devise-1.1.3/lib/devise.rb:193:in `mailer=': undefined method `ref' for ActiveSupport::Dependencies:Module (NoMethodError)
    from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.3/lib/devise.rb:195:in `<module:Devise>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.3/lib/devise.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/mihai/Desktop/blog/config/application.rb:7:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Please help me!请帮我!

The version of Devise is rather old. Devise的版本相当陈旧。

You can do: 你可以做:

bundle update devise

And then: 然后:

bundle install

This should upgrade the Devise gem. 这应该升级Devise gem。

you can try to put this inside your Gemfile instead of just gem 'devise'你可以尝试把它放在你的Gemfile而不是gem 'devise'

gem 'devise', github: 'ghiculescu/devise', branch: 'patch-2'

Re-run bundle install重新运行bundle install

and then you can do rails generate devise:install然后你可以做rails generate devise:install

It should be: 它应该是:

rails generate devise_install 

and not: 并不是:

rails generate devise:install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM