Hi everyone,

We are using DataMapper in our application. A few days ago the following 
started happening: when we do a save or update on a DataMapper Resource, 
we'll get the following:

undefined method `eager_load' for 
#<DataMapper::Validations::ContextualValidators:0x69037c66>

I have tried to reproduce it with irb with no success. This is happening 
way inside of a participant we're loading with ruote, using DataMapper 
1.2.0. It seems to happen randomly, i.e., on a run it might happen on one 
resource, on another run it might happen on a different one.

This is the definition of one of the offending Resources:

class Slot
  include DataMapper::Resource
  property :id, Serial
  property :station, Integer
  property :slotnumber, Integer
  property :firmwareversion, String, :length=>255
  property :hardwareversion, String, :length=>255
  property :mechanicalversion, String, :length=>255
  property :chargertype, String, :length=>255
  property :statusledred, Boolean
  property :statusledgreen, Boolean
  property :statuscharging, Boolean
  property :statusopen, Boolean
  property :statusclosed, Boolean
  property :statusoccupied, Boolean
  property :lastalarm, String, :length=>4096
  property :lastalarmtimestamp, DateTime
  property :status, String, :length=>255
  property :comments, Text
  property :blocked, Boolean
end

Here is the backtrace:

["/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations/contextual_validators.rb:215:in
 
`load_validated_prop
erties'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations/contextual_validators.rb:199:in
 
`execute'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:86:in
 
`valid?'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:51:in
 
`save_self'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1006:in
 
`_save'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1222:in
 
`run_once'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1220:in
 
`run_once'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1005:in
 
`_save'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:405:in
 
`save'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:40:in
 
`save'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations/context.rb:16:in
 
`in_context'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:40:in
 
`save'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:379:in
 
`update'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:46:in
 
`update'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations/context.rb:16:in
 
`in_context'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-validations-1.2.0/lib/dm-validations.rb:46:in
 
`update'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/participants/update_model.rb:22:in
 
`consume'"   
 "org/jruby/RubyArray.java:1615:in `each'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/participants/update_model.rb:15:in
 
`consume'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-transactions-1.2.0/lib/dm-transactions.rb:373:in
 
`transaction'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-transactions-1.2.0/lib/dm-transactions.rb:131:in
 
`commit'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-transactions-1.2.0/lib/dm-transactions.rb:195:in
 
`within'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-transactions-1.2.0/lib/dm-transactions.rb:131:in
 
`commit'"   
 
"/Users/mario/projects/Gyokuro/Workflow/lib/gems/jruby/1.8/gems/dm-transactions-1.2.0/lib/dm-transactions.rb:373:in
 
`transaction'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/participants/update_model.rb:12:in
 
`consume'"    "org/jruby/RubyKernel.java:2080:in `send'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/ruote-components/ruote/lib/ruote/svc/dispatch_pool.rb:202:in
 
`participant_send'"    "org/jruby/RubyArray.java:1615:in `each'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/ruote-components/ruote/lib/ruote/svc/dispatch_pool.rb:193:in
 
`participant_send'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/ruote-components/ruote/lib/ruote/svc/dispatch_pool.rb:74:in
 
`do_dispatch'"   
 
"/Users/mario/Desktop/abstra.cc/projects/Gyokuro/Workflow/ruote-components/ruote/lib/ruote/svc/dispatch_pool.rb:102:in
 
`do_threaded_dispatch'"    "org/jruby/RubyProc.java:270:in `call'"
 "org/jruby/RubyProc.java:224:in `call'"]

The only DataMapper require is a single require 'data_mapper', we aren't 
requiring dm-validations (or even mentioning it in the Gemfile). The 
offending line in contextual_validators.rb is:

        resource.__send__(:eager_load, properties_to_load)

I went in and added some logging for the resource and 
properties_to_loadvariables:

resource: #<Slot @id=8 @station=1 @slotnumber=1 @firmwareversion="" 
@hardwareversion="" @mechanicalversion="" @chargertype="TEST" 
@statusledred=nil @statusledgreen=nil @statuscharging=false 
@statusopen=false @statusclosed=false @statusoccupied=false @lastalarm="" 
@lastalarmtimestamp=nil @status="FREE" @comments=<not loaded> 
@blocked=false>
properties_to_load:[#<DataMapper::Property::Text @model=Slot 
@name=:comments>, #<DataMapper::Property::Text @model=Slot @name=:comments>]

Any ideas? Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/EsDKcM9KRZcJ.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to