Created
April 30, 2011 00:34
-
-
Save albertoleal/949282 to your computer and use it in GitHub Desktop.
Couch Rest model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
shop = ShoppingCoupon.new(:name => 'Shop', :description =>"Clothes", | |
:items => [{:name => 'shirt', :price => 2.50}, {:name => 'pants', :price => 5}], | |
:purchased =>2011/03/21, :amount => 43.2) | |
shop.save | |
=end | |
class Items < Hash | |
include CouchRest::Model::CastedModel | |
property :name, String | |
property :price, Float | |
end | |
class ShoppingCoupon < CouchRest::Model::Base | |
use_database CouchServer.default_database | |
property :name, String | |
property :description, String | |
property :items, [Items] | |
property :purchased, DateTime | |
property :amount, Float | |
timestamps! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment