1

我正在尝试将现有应用程序迁移到 ruby​​ 2.0 + rails 4.0 并且到目前为止一切正常,除了当我尝试安装设计时:

rails generate devise:install

我收到以下错误:

Exiting
    /home/lemur/rails_projects/delicateca/config/initializers/devise.rb:76:in `block in <top (required)>': undefined method `skip_session_storage=' for Devise:Module (NoMethodError)
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/devise-1.5.4/lib/devise.rb:252:in `setup'
        from /home/lemur/rails_projects/delicateca/config/initializers/devise.rb:3:in `<top (required)>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `block in load'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:213:in `load_dependency'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/engine.rb:608:in `block (2 levels) in <class:Engine>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/engine.rb:607:in `each'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/engine.rb:607:in `block in <class:Engine>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `run'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:44:in `each'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:44:in `tsort_each_child'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:186:in `each'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:186:in `each_strongly_connected_component'
        from /home/lemur/.rvm/rubies/ruby-2.0.0-preview1/lib/ruby/2.0.0/tsort.rb:154:in `tsort_each'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/application.rb:213:in `initialize!'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /home/lemur/rails_projects/delicateca/config/environment.rb:5:in `<top (required)>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `require'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `block in require'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:213:in `load_dependency'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:228:in `require'
        from /home/lemur/rails_projects/delicateca/config.ru:3:in `block in <main>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
        from /home/lemur/rails_projects/delicateca/config.ru:in `new'
        from /home/lemur/rails_projects/delicateca/config.ru:in `<main>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:46:in `app'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:71:in `start'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/commands.rb:78:in `block in <top (required)>'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `tap'
        from /home/lemur/.rvm/gems/ruby-2.0.0-preview1/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `<top (required)>'
        from script/rails:6:in `require'

当我尝试运行应用程序时,我得到了同样的错误,只是执行 bundle install 然后 rails s。

任何的想法?

谢谢!

4

2 回答 2

5

[更新]

rails4 分支现已合并到 master 中。所以这应该是你现在所需要的:

gem 'devise', github: 'plataformatec/devise'

我在下面留下了我的旧答案。

=================================================

今天最简单的解决方法是在您的 gemfile 中使用以下内容:

gem 'devise', github: 'plataformatec/devise', branch: 'rails4'

More details can be found on the comment of this pull request for Devise.

At the time of Lemurido's response, his was the best solution to your error.

于 2013-04-05T16:16:32.807 回答
0

正如 Aaron Paterson 所解释的,这似乎是一个依赖问题:

http://tenderlovemaking.com/2012/12/18/rails-4-and-your-gemfile.html

解决方案(在评论中)正在更新您的 gemfile:

宝石“设计”,github:“idl3/devise”,分支:“rails4”

于 2013-03-09T23:29:16.270 回答