5

我是 Ruby on Rails 的新手,我尝试从 Internet 上做一些示例。但是当我尝试生成设计安装时出现错误。我通过添加gem devise 修改了 Gemfile 。然后运行:

bundle install

但是当我跑步时。

rails generate devise:install

我有下一个错误:

/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>'

请帮我!

4

3 回答 3

6

Devise 的版本比较老。

你可以做:

bundle update devise

接着:

bundle install

这应该升级设计 gem。

于 2013-05-07T08:20:24.787 回答
1

你可以试着把它放在你的里面Gemfile而不是仅仅gem 'devise'

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

重新运行bundle install

然后你可以做rails generate devise:install

于 2021-10-09T19:03:30.897 回答
0

它应该是:

rails generate devise_install 

并不是:

rails generate devise:install
于 2014-11-03T16:42:16.700 回答