After upgrading to Rails 3.1 any ActiveRecord call has the following result:
ArgumentError: wrong number of arguments (3 for 2)
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-sqlserver-adapter-3.0.3/lib/active_record/connection_adapters/sqlserver/database_statements.rb:185:in `select'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `select_all'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/base.rb:469:in `find_by_sql'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/relation.rb:106:in `to_a'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/relation/finder_methods.rb:155:in `all'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/base.rb:440:in `all'
from (irb):1
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc1/lib/rails/commands/console.rb:44:in `start'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc1/lib/rails/commands/console.rb:8:in `start'
from /Users/username/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.0.rc1/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Anyone else run into this issue?
check your gemfile, you need the newest mysql2 gem for rails 3 to work:
replace
gem 'mysql2', '0.2.7'
with
gem 'mysql2', '>=0.3'
and run a "bundle install" and you should be good to go
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With