1

当我尝试跑步时

$ rails console

我收到以下错误

/usr/local/lib/ruby/gems/2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `arel_attributes_values' for class `ActiveRecord::Base' (NameError)

...... 其他错误如下......这只是回溯

我的版本如下

$ gem -v
2.0.5
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41647) [x86_64-linux]
$ rails -v
Rails 4.0.0
$ rvm -v 
rvm 1.21.11 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ uname -a
Linux cdv-web01 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

我是否必须安装一个我不知道的 gem?

更新:包括整个追溯......

Warning: NLS_LANG is not set. fallback to US7ASCII.
/home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `arel_attributes_values' for class `ActiveRecord::Base' (NameError)
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb:116:in `<class:Base>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb:2:in `<module:ActiveRecord>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb:1:in `<top (required)>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:211:in `block in load_dependency'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:211:in `load_dependency'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:38:in `<top (required)>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:211:in `block in load_dependency'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:211:in `load_dependency'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-oracle_enhanced-adapter-1.4.2/lib/activerecord-oracle_enhanced-adapter.rb:12:in `block in <class:OracleEnhancedRailtie>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.0/lib/active_record/base.rb:322:in `<module:ActiveRecord>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.0/lib/active_record/base.rb:22:in `<top (required)>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/maintenance_scheduler/app/models/cmts_device.rb:1:in `<top (required)>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `load'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `block in load_file'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:in `load_file'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:in `require_or_load'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:288:in `depend_on'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:206:in `require_dependency'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
        from /home/aayerd200/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/maintenance_scheduler/config/environment.rb:7:in `<top (required)>'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:189:in `require'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
        from /home/aayerd200/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:63:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

使用 ReadyForRails4...

输入为...

source 'http://rubygems.org'

gem 'rails', '4.0.0'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'activerecord-oracle_enhanced-adapter'
gem 'ruby-oci8'
gem 'mysql2'
gem 'prototype-rails'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

在此处输入图像描述

4

2 回答 2

8

似乎 gemactiverecord-oracle_enhanced-adapter与 Rails 4 不兼容。

这是应该具有该方法的文件arel_attributes_value

http://github.com/rails/rails/blob/master/activerecord/lib/ ...

这是 3.2-stable 分支的文件。

http://github.com/rails/rails/blob/3-2-stable/activerecord/lib/ ...

该方法在第二个文件(3.2-stable)中,但不在第一个文件(主文件)中。所以它可能在 Rails 4 中被删除了。

如果我是你,我现在只是恢复到 3.2,但如果你想使用 Rails 4,似乎 Rails 4 有一个分支。

所以你去你的 Gemfile 并更改行

gem 'activerecord-oracle_enhanced-adapter'

gem 'activerecord-oracle_enhanced-adapter',github:'rsim/oracle-enhanced',分支:'rails4'

bundle update。那应该这样做。

于 2013-07-17T20:08:53.523 回答
0

activerecord-oracle_enhanced-adapter gem的更新版本支持 Rails 4。

将此添加到您的 gem 文件中

gem "activerecord-oracle_enhanced-adapter", "~> 1.5.0"

这对我来说适用于 Rails 4.0.2

希望这可以帮助。

PS:这是gem的github链接

于 2015-01-16T13:11:32.020 回答