我遇到jruby和activerecord-3.1.0.rc5的多个问题。
例如,在我运行迁移之后,我从rails控制台创建了一个简单的Role对象,一切都很好:
jruby-1.6.3 :006 > r = Role.new(:name => "Standard")
=> #<Role id: nil, name: "Standard", created_at: nil, updated_at: nil>
然后我要显示所有角色,以便我输入
jruby-1.6.3:007&gt; Role.all
我得到以下堆栈跟踪:
argumentError: wrong number of arguments (3 for 2)
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/activerecord-3.1.0.rc5/lib/active_record/base.rb:470:in `find_by_sql'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/activerecord-3.1.0.rc5/lib/active_record/relation.rb:111:in `to_a'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/activerecord-3.1.0.rc5/lib/active_record/relation/finder_methods.rb:155:in `all'
from org/jruby/RubyBasicObject.java:1684:in `__send__'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/activerecord-3.1.0.rc5/lib/active_record/base.rb:437:in `all'
from (irb):7:in `evaluate'
from org/jruby/RubyKernel.java:1093:in `eval'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1205:in `catch'
from org/jruby/RubyKernel.java:1205:in `catch'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/railties-3.1.0.rc5/lib/rails/commands/console.rb:45:in `start'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/railties-3.1.0.rc5/lib/rails/commands/console.rb:8:in `start'
from /Users/paulcowan/.rvm/gems/jruby-1.6.3/gems/railties-3.1.0.rc5/lib/rails/commands.rb:40:in `(root)'
from org/jruby/RubyKernel.java:1047:in `require'
from script/rails:6:in `(root)'
我收到以下错误:
ArgumentError:错误的参数数量(3为2)
Rails 3.1r5相当多。整件事看起来很蠢。还有其他人遇到过这些问题吗?
我提到了一些非常相似的here:
ActiverREcord似乎失败了。
以下是我用于jruby数据访问的内容:
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3', :require => false
还有其他人遇到这些问题吗?