3

我遵循这里提到的基本说明:http: //guides.spreecommerce.com/getting_started.html

顺便说一句,我的 Gemfile 中已经有了gem 'devise-encryptable'

当我cd进入mystore并尝试运行spree install时,这是我得到的错误:

/usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptable.rb:28:in `<top (required)>': undefined method `add_module' for Devise:Module (NoMethodError)
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise-encryptable.rb:1:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise-encryptable.rb:1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
    from /Users/amiterandole/Desktop/current/rails/mystore/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:24:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
from script/rails:6:in `<main>'

发生了什么,我该如何解决?我碰巧正在使用最新版本的 rails 和 spree。我安装的设计版本是devise-2.2.2

更新:这是我的 gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.11'

gem 'pg'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'devise-encryptable'

# To use debugger
# gem 'debugger'
gem 'spree', '1.3.1'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
4

3 回答 3

9

尝试放置这条线 gem 'devise-encryptable'

在 Gemfile 的底部。这解决了我的问题。可能 devise-encryptable gem 会找到没有 Devise.add_module 方法的旧版本的 Devise。

于 2013-01-23T18:19:58.750 回答
1

I ran into this error just now and have a solution. You need to open file lib/devise-encryptable.rb in the gem's directory and add this line at the beginning: require 'devise'. And don't forget to follow this advice. Enjoy.

于 2013-01-24T18:33:38.120 回答
0

Remove gem 'devise-encryptable' from your Gemfile, as it is already specified as a dependency in the spree_auth_devise gem. What's happening here is that this gem is being loaded before the devise gem, which is why your application is breaking.

于 2013-01-23T19:44:11.240 回答