I’ve got a current Ruby 1.9 project that testing w/jruby’s 1.9 mode.
I’m running into an odd issue though. I’m getting very flaky results
when doing when accessing the db.
in essence, “Model.order(“order clause”).first” works, but
“Model.order(“order clause”)” throws an error. Is there something I
need to configure still?
commands, database.yml, gem list, and stack trace here:
Stack Trace.log
AllowedCode.find(:all, :order => "state_abbreviation")
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/activerecord-jdbc-adapter-1.1.1/lib/arel/visitors/sql_server.rb:34:in `visit_Arel_Nodes_SelectStatement'
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/arel-2.0.9/lib/arel/visitors/visitor.rb:15:in `send'
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/arel-2.0.9/lib/arel/visitors/visitor.rb:15:in `visit'
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/arel-2.0.9/lib/arel/visitors/visitor.rb:5:in `accept'
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/arel-2.0.9/lib/arel/visitors/to_sql.rb:19:in `accept'
from /home/mmoyer/.rvm/gems/jruby-1.6.1@class-codes/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:111:in `with_connection'
This file has been truncated. show original
commands
jruby-1.6.1 :026 > AllowedCode.order("state_abbreviation asc").first
=> #<AllowedCode id: 72, state_abbreviation: "CO", effective_date: "2011-01-01", class_code: "0005", sub_code: "00", code_description: "FARM: NURSERY EMPLOYEES & Drivers", enabled: false, expired: false, created_at: nil, updated_at: nil>
jruby-1.6.1 :027 > AllowedCode.order("state_abbreviation asc")
(Object doesn't support #inspect)
database.yml
development: &development
adapter: jdbcmssql
host: 10.2.10.7
database: mydbname
username: dbuser
password: dbpass
There are more than three files. show original
I added a require_relative function to my app so that it would be able
to run in 1.8 mode and I don’t see any of the errors I was getting in
1.9 mode.