in reply to Re: Object Persistence, Moose and playing nicely with ActiveRecord
in thread Object Persistence, Moose and playing nicely with ActiveRecord
The documents table has a set of columns which is the superset of attributes of Document and all its subclass and a type column which contains the name of the class for that row. Document->find finds Documents, Reviews and any other subclasses of document, Review->find finds only reviews (and any subclasses).package Review use Moose extends 'Document'
Composed of: A way of getting round primitive obsession. You can declare something like:
And ActiveRecord handles turning cents and currency columns into a Money object when the object is pulled out of the database breaking the price into cents and currency the the object's put back in there.composed_of :price, :class_name => 'Money', :mapping => %w{cents currency}
Bells and whistles: Mostly to do with declaring relationships between classes with has_many/belongs_to etc. If you want me to regurgitate the ActiveRecord::Base documentation then I will, but it's far from being the world's best documentation in the first place and my paraphrasing skills are poor. Most of the perly ORMs appear to have sensible equivalents already so it won't be beyond my wit to sort out the mapping.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Object Persistence, Moose and playing nicely with ActiveRecord
by perrin (Chancellor) on Sep 08, 2008 at 16:41 UTC | |
|
Re^3: Object Persistence, Moose and playing nicely with ActiveRecord
by Corion (Patriarch) on Sep 08, 2008 at 15:09 UTC |