Sha256: 35840315a83b9a56b156f5de52b664494c3b471f9a81ff3aca868b439390088e

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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
----------------
1. Serialization in any format: to_xml, to_yaml methods (and of course from_xml, from_yaml methods as well)
2. Callbacks: Define any callback for any event (This is stolen from ActiveRecord)
3. More Sexiness and Awesomeness

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arunthampi-supermodel-0.1.0 README