Skip to content

Instantly share code, notes, and snippets.

@merbjedi
Forked from dkubb/base_model.rb
Created September 27, 2009 07:45
Show Gist options
  • Save merbjedi/194657 to your computer and use it in GitHub Desktop.
Save merbjedi/194657 to your computer and use it in GitHub Desktop.
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