This only happens with oracle, not with mysql nor mssql. If I don´t
include
config.time_zone= ‘UTC’ or similar in environment.rb I get this error
when
trying to access a date field in a record, even in the console if doing
something similar to this:
u=User.find(:first)
u.created_at generates the error:
NoMethodError: undefined method `string_to_time’ for #Class:0x7da4770d
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1994:in
method_missing' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_oracle.rb:70:in
string_to_time’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:1:in
token_vigencia' from /Users/jmurillo/NetbeansProjects/jonFRP/app/models/cnf_usuarios.rb:42:in
before_create’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:347:in
callback' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:265:in
create_with_callbacks’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2915:in
create_or_update' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:250:in
create_or_update_with_callbacks’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2590:in
save!' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/validations.rb:1100:in
save_with_validation!’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/dirty.rb:87:in
save_with_dirty!' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in
save_with_transactions!’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in
transaction' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:182:in
transaction’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in
save_with_transactions!' from /Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:208:in
rollback_active_record_state!’
from
/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in
`save_with_transactions!’
from (irb):16>>
I wrote a file modi_jdbc_oracle and included it in environment.rb with:
require “modi_jdbc_oracle”
I also noticed that in simplified_type with numeric values, the
parameter
received(field_type) is always number, so you dont´t get the scale for
converting it into :integer instead of BigDecimal, however you have
access
to @name, so if the name ends with _id I return an :integer
Is this the best way to fix it?
I am attaching the file
I tried this with jruby 1.5.2, activercord-jdbc-adapter-0.9.7-java and
both
rails: 2.2.2 and 2.3.8
Thank you
http://old.nabble.com/file/p29965415/modi_jdbc_oracle.rb
modi_jdbc_oracle.rb
View this message in context:
http://old.nabble.com/Error-in-jdbc_oracle-when-not-including-config.time_zone-in-environment.rb-tp29965415p29965415.html
Sent from the JRuby - User mailing list archive at Nabble.com.