I use DataMapper (1) as part of a couple of Rack apps and generally find it 
works beautifully.

For development, I use Rack::Reloader, so that I can just change a source 
file and not have to bother restarting the Rack app. However, this has a 
habit of throwing an exception related to DM's associations. Typically I'll 
get something like this:

ArgumentError: +options[:field]+ entry :site_id does not map to a property 
in Marker
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:805:in
 
`block in assert_valid_fields'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:796:in
 
`each'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:796:in
 
`assert_valid_fields'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-aggregates-1.2.0/lib/dm-aggregates/query.rb:23:in
 
`assert_valid_fields_with_operator'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:768:in
 
`block in assert_valid_options'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:766:in
 
`each'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:766:in
 
`assert_valid_options'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/query.rb:363:in
 
`update'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/associations/relationship.rb:158:in
 
`block in query_for'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/repository.rb:114:in
 
`scope'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/associations/relationship.rb:153:in
 
`query_for'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/associations/relationship.rb:308:in
 
`eager_load'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/collection.rb:1477:in
 
`delegate_to_relationship'
/usr/local/Cellar/ruby/2.0.0-p0/lib/ruby/gems/2.0.0/gems/dm-core-1.2.0/lib/dm-core/collection.rb:1446:in
 
`method_missing'
/Users/richard/Code/avanti_kite/model/marker.rb:154:in `bbox_search'

The association is this:
belongs_to :site, :required => false

and it's being called like this in marker.rb/154:
user.organisation.sites.markers(filter)

but this isn't a one-off - it happens in my other apps too. It always 
happens on the first refresh after Rack has reloaded the app.

It's not fatal - I can always manually restart the app - but it's a PITA. 
Any thoughts?

Richard

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper.
For more options, visit https://groups.google.com/d/optout.

Reply via email to