Created
January 30, 2013 04:24
-
-
Save mikeebert/4670603 to your computer and use it in GitHub Desktop.
Example of a DataMapper Repository
This file contains 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 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