SuperModel aims to give sexy semantics to any model/library in Ruby that you might create. This includes has, has_many and has_one semantics which we generally associate with ActiveRecord.
This project draws its roots from the ActiveCouch project (http://www.github.com/arunthampi/activecouch), after which I saw myself re-using the same semantics in many other projects.
Hence, the SuperModel project was born!
The irony is that even though a SuperModel will be more bloated than a regular Ruby model, it will be better looking.
So with SuperModel, you can define a model such as this:
class Person < SuperModel::Base
has :name, :which_is => :text, :with_default_value => "McLovin"
end
Also supports JSON serialization, so you can do this:
p = Person.new(:name => 'McLovin').to_json # => {"name":"McLovin"}
Plans For Future
- Serialization in any format: to_xml, to_yaml methods (and of course from_xml, from_yaml methods as well)
- Callbacks: Define any callback for any event (This is stolen from ActiveRecord)
- More Sexiness and Awesomeness