ArgumentError:使用 activerecord-sqlserver-adapter 升级到 Rails 3.1 后参数数量错误(3 为 2)

发布于 2024-11-10 03:35:33 字数 1568 浏览 0 评论 0原文

升级到 Rails 3.1 后,任何 ActiveRecord 调用都会产生以下结果:

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

还有其他人遇到此问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾其所爱 2024-11-17 03:35:33

检查你的 gemfile,你需要最新的 mysql2 gem 才能让 Rails 3 工作:

替换

gem 'mysql2',  '0.2.7'

gem 'mysql2',  '>=0.3'

并运行“捆绑安装”,你应该可以开始了

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

绝影如岚 2024-11-17 03:35:33

您还需要更新到 sql server 适配器的 master 分支。这将是最终的 3.1 版本。 3.0 版本的适配器适用于 3.0 导轨。所以你的适配器已经过时了。

You also need to update to the master branch of the sql server adapter. It will be the eventual 3.1 version. 3.0 versions of the adapter are for 3.0 rails. So your adapter is out of date.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文