-
-
Save merbjedi/194657 to your computer and use it in GitHub Desktop.
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
module BaseModel | |
def self.included(model) | |
model.class_eval <<-RUBY, __FILE__, __LINE__ + 1 | |
include DataMapper::Resource | |
property :id, Serial | |
timestamps :at | |
RUBY | |
end | |
end | |
class Customer | |
include BaseModel | |
property :name, String | |
has n, :orders | |
end | |
class Order | |
include BaseModel | |
property :reference_code, String | |
belongs_to :customer | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment