在我的应用程序中包含数据库分片gem octopus后,我收到以下错误...有人可以帮助我吗?.....
/usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `announce' for class `Class' (NameError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
from /usr/lib/ruby/gems/1.8/gems/ar-octopus-0.3.4/lib/octopus/migration.rb:9:in `extended'
from /usr/lib/ruby/gems/1.8/gems/ar-octopus-0.3.4/lib/octopus/migration.rb:73:in `extend'
from /usr/lib/ruby/gems/1.8/gems/ar-octopus-0.3.4/lib/octopus/migration.rb:73
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/ar-octopus-0.3.4/lib/octopus.rb:66
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /var/www/scandetails/config/application.rb:7
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:38:in `require'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:38
from script/rails:6:in `require'
from script/rails:6
答案 0 :(得分:7)
根据this pull request,已经在gem的主分支中添加了Rails 3.1支持,但更新版本为has not be released。您可以通过引用Gemfile中的github存储库来使用存储库的主分支作为gem的源:
gem 'ar-octopus', :git => "git://github.com/tchandy/octopus.git", :require => "octopus"
答案 1 :(得分:0)
我尝试使用master branch reporsitoty中的ar-octupos,但是我仍然遇到捆绑安装错误。
Bundler could not find compatible versions for gem "activesupport":
在快照(Gemfile.lock)中:
activesupport(3.1.12)
在Gemfile中:
ary章鱼(> = 0)红宝石取决于
activesupport(> = 3.2.0)ruby
运行bundle update
将仅使用从头开始重建快照
Gemfile中的宝石,可以解决冲突。