使用 ODBC 适配器时出现此错误。难道是我的版本不匹配?看起来我正在使用 activerecord-odbc-adapter-2.0 和 activerecord-3.1.0。
wrong number of arguments (3 for 2)
/var/lib/gems/1.9.1/gems/activerecord-odbc-adapter-2.0/lib/active_record/connection_adapters/odbc_adapter.rb:765:in `select_all'
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:470:in `find_by_sql'
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/relation.rb:111:in `to_a'
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/relation.rb:15:in `each'
/usr/local/www/sl-exchange/app/controllers/states_controller.rb:15:in `block in update'
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/www/sl-exchange/app/controllers/states_controller.rb:12:in `update'
/usr/local/www/sl-exchange/lib/exchange.rb:97:in `initialize'
/usr/local/www/sl-exchange/lib/exchange.rb:191:in `new'
/usr/local/www/sl-exchange/lib/exchange.rb:191:in `<top (required)>'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `load'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `start_load'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:298:in `start'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/controller.rb:70:in `run'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons.rb:147:in `block in run'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons.rb:146:in `run'
./data_exchange_preview:15:in `<main>'
Connection refused - connect(2)
/usr/lib/ruby/1.9.1/net/smtp.rb:551:in `initialize'
/usr/lib/ruby/1.9.1/net/smtp.rb:551:in `open'
/usr/lib/ruby/1.9.1/net/smtp.rb:551:in `block in do_start'
/usr/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/usr/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
/usr/lib/ruby/1.9.1/net/smtp.rb:551:in `do_start'
/usr/lib/ruby/1.9.1/net/smtp.rb:525:in `start'
/usr/lib/ruby/1.9.1/net/smtp.rb:463:in `start'
/usr/local/www/sl-exchange/app/controllers/controller.rb:21:in `send_notification'
/usr/local/www/sl-exchange/app/controllers/controller.rb:29:in `handle_exception'
/usr/local/www/sl-exchange/app/controllers/states_controller.rb:45:in `rescue in update'
/usr/local/www/sl-exchange/app/controllers/states_controller.rb:4:in `update'
/usr/local/www/sl-exchange/lib/exchange.rb:97:in `initialize'
/usr/local/www/sl-exchange/lib/exchange.rb:191:in `new'
/usr/local/www/sl-exchange/lib/exchange.rb:191:in `<top (required)>'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `load'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `start_load'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb:298:in `start'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/controller.rb:70:in `run'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons.rb:147:in `block in run'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/var/lib/gems/1.9.1/gems/daemons-1.1.9/lib/daemons.rb:146:in `run'
./data_exchange_preview:15:in `<main>'
这是我的代码中失败的行:
states_controller.rb:
class StatesController < Controller
def update()
...
Web::State.transaction do #<-- this is line 12
nti_states.each do |state| #<-- line 15
...
(这只是一个 ruby 应用程序。不是 rails)如果您需要更多信息,请告诉我。