ActiveRecord: save and create fails with legacy schema

I’m working with a legacy schema in which almost all the column names
are
uppercase, the primary key field name is ‘ID’ and it’s data type is
‘uniqueidentifier’.

SQL Server 2008
Ruby 1.8.7
ActiveRecord 3.0.3
activerecord-sqlserver-adapter 3.0.9
arel 2.0.8
Windows XP

When I try to create a model object or save one that’s been modified, I
get the following:

irb(main):001:0> ts = TableSchema.first
=> #<TableSchema ID: “34586F9A-26BC-4060-AA2F-0F278B6E1B76”, TABLE_NAME:
“XML_ATTR_INST”, DISPLAY_NAME: “XML Attribute I
nstance”, Type: 3, DESCR: “Container for XML data types”, DELETED_FLAG:
false, CLASS_ID: “085F7B9E-399D-48AD-A7A3-2AD487
69F99B”>
irb(main):002:0> ts.DESCR=“Container for XML data types MODIFIED”
=> “Container for XML data types MODIFIED”
irb(main):003:0> ts.save
NoMethodError: undefined method eq' for nil:NilClass from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:inmethod_missing’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/persistence.rb:255:in
update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/locking/optimistic. rb:77:inupdate’ from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods/d
irty.rb:68:in update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/timestamp.rb:60:inupdate’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:285:in
update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:413:in_run_update_callbacks’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:285:in
update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/persistence.rb:246:increate_or_update’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:277:in
create_or_update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:423:in_run_save_callbacks’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/callbacks.rb:277:in
create_or_update' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/persistence.rb:39:insave’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/validations.rb:43:in
save' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods/dirty.rb:21:insave’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:in
save' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:289:inwith_transaction_returning_status’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
transaction' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:204:intransaction’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:287:in
with_transaction_returning_status' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:237:insave’
from
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:248:in
rollback_active_record_state!' from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-3.0.3/lib/active_record/transactions.rb:236:insave’
from (irb):3
from :0irb(main):004:0>

See the attachment for table and model definitions.

What is the problem here? How can I debug this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs