fzxu / mongoid_order Goto Github PK
View Code? Open in Web Editor NEWAn easy way to make Mongoid documents order-able by adding position field
License: MIT License
An easy way to make Mongoid documents order-able by adding position field
License: MIT License
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 ....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.