Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created April 24, 2009 19:56
Show Gist options
  • Select an option

  • Save julesfern/101316 to your computer and use it in GitHub Desktop.

Select an option

Save julesfern/101316 to your computer and use it in GitHub Desktop.
# 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