mongoid_order
mongoid_order copied to clipboard
doesn't work with embedded documents
receiving this error when trying mongoid_order on embedded document association,
Access to the collection for Photo is not allowed since it is an embedded document, please access a collection from the root document.
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/collections.rb:27:in `collection'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/contexts/mongo.rb:53:in `blank?'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/criteria.rb:45:in `empty?'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/gems/mongoid_order-0.0.4/lib/mongoid_order.rb:148:in `assign_default_position'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/callbacks.rb:395:in `_run_save_callbacks'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/persistence/insert.rb:26:in `block in persist'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/persistence/insert.rb:25:in `tap'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/persistence/insert.rb:25:in `persist'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/persistence.rb:47:in `insert'
/Users/david/.rvm/gems/ruby-1.9.2-p180@rails31/bundler/gems/mongoid-d86d31a18253/lib/mongoid/persistence.rb:148:in `upsert'
....
mongoid_order.rb:148:in `assign_default_position' -- obviously the collection is not available to an embedded doc, any good ideas on how the position could be calculated for embedded associations here? I'm unfamiliar with mongoids' association code, so haven't taken stab at solving this yet ....