Created
April 24, 2009 19:56
-
-
Save julesfern/101316 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
| # Public API | |
| # --------------------------------------------------------------------------------- | |
| # The following methods are intended to be a stable, repository-safe frontend | |
| # that place restrictions upon you in exchange for you not having to put repository | |
| # blocks absolutely fucking everywhere in the application. | |
| # Override the finder methods to always use the :garden repository regardless of the | |
| # contents of DataMapper's repository context stack. | |
| def self.first(*args) | |
| DataMapper.repository(:garden) { super } | |
| end | |
| def self.all(*args) | |
| DataMapper.repository(:garden) { super } | |
| end | |
| def self.count(*args) | |
| DataMapper.repository(:garden) { super } | |
| end | |
| # Overrides the #save method to save all objects to the :garden repostory regardless | |
| # of the contents of DataMapper's repository context stack. | |
| def save(*args) | |
| DataMapper.repository(:garden) { super } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment