Skip to content

Instantly share code, notes, and snippets.

@mikeebert
Created January 30, 2013 04:24
Show Gist options
  • Save mikeebert/4670603 to your computer and use it in GitHub Desktop.
Save mikeebert/4670603 to your computer and use it in GitHub Desktop.
Example of a DataMapper Repository
module DataMapperRepository
class UserRepository
def model_class
DataMapperRepository::User
end
def new(attributes = {})
model_class.new(attributes)
end
def save(object)
object.save
return object
end
def find_by_id(n)
model_class.get
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment