harmonickey
harmonickey

Reputation: 1419

Undefined method `arel_attributes_values' for class `ActiveRecord::Base'

When I try to run

$ rails console

I get the following error

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

............. Other errors follow... that are just tracebacks

My versions are as follows

$ 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 <[email protected]>, Michal Papis <[email protected]> [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

Do I have to install a gem that I don't know about?

UPDATE: Included is the whole traceback...

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

With ReadyForRails4...

Input as...

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

enter image description here

Upvotes: 1

Views: 2658

Answers (2)

Nayana Bhagat
Nayana Bhagat

Reputation: 51

The updated version of the activerecord-oracle_enhanced-adapter gem supports Rails 4.

Add this to your gem file

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

This worked for me for Rails 4.0.2

Hope this helps.

PS: Here is the github link for the gem.

Upvotes: 0

Doodad
Doodad

Reputation: 1518

It seems the gem activerecord-oracle_enhanced-adapter is not compatible with Rails 4.

This is the file which should have that method arel_attributes_value:

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

And here is the file at 3.2-stable branch.

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

The method is there at the second file (3.2-stable), but it's not in the first (master). So it was probably removed in Rails 4.

If I were you I'd just revert back to 3.2 for now, but if you want to use Rails 4 anyway, it seems there's a branch for Rails 4.

So you go to your Gemfile and change the line

gem 'activerecord-oracle_enhanced-adapter'

to

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

and bundle update. And that should do it.

Upvotes: 8

Related Questions