Last active
May 18, 2016 16:16
-
-
Save flash-gordon/00cf090d3c48cd4d5aa69e470a4a1d4d 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
Class.new(ROM::Repository[relation]) do | |
defines :mapping | |
commands :create, update: :by_id, delete: :by_id, mapper: mapping | |
self.mapping mapping | |
def find(id) | |
collection.by_id(id).one | |
end | |
def all | |
collection | |
end | |
def collection | |
root.as(self.class.mapping) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment