candy
candy copied to clipboard
Transparent persistence for MongoDB
``` class Email include Candy::Piece end class Emails include Candy::Collection collects Email end Emails.each do |email| email.provider # => nil email.refresh email.provider # => "some value" end ``` Imho, it...
``` ruby-1.9.1-p378 > c = Person.name('Bob Smith') ArgumentError: wrong number of arguments(1 for 0) from (irb):5:in `name' from (irb):5 from /Volumes/seley01/Users/steve/.rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `' ```
Currently you can't just to Person.id(_whatever_) -- if the 'magic' Person(_whatever_) method doesn't work, you have to do Person.first(_id: _whatever_). This should change.
``` > t = Thingy.new > t.whatsit = Widget.new >t.whatsit.collection # => 'Widget' ``` This is wrong. The collection should be _Thingy._
Doing this: ``` u = User.new p = Payment.embed p.date = Time.now p.amount = 5.00 u.payment = p ``` ...results in a _Payment_ collection being made and the Payment record...
Breaking on objects with parameters in their initializers is just too brittle. It'd be smarter to try a series of strategies, in order: 1. **to_mongo** if the object responds to...
Because of an embedded object that we couldn't unwrap, I get: ``` ruby-1.9.1-p378 > c = Register::Person.email('[email protected]') ArgumentError: wrong number of arguments (0 for 2) from /Volumes/seley01/Users/steve/.rvm/gems/ruby-1.9.1-p378@sinatra/gems/candy-0.2.6/lib/candy/wrapper.rb:132:in `new' from /Volumes/seley01/Users/steve/.rvm/gems/ruby-1.9.1-p378@sinatra/gems/candy-0.2.6/lib/candy/wrapper.rb:132:in...
