Created
July 31, 2014 13:01
-
-
Save girasquid/b48d2f9fb762a94c7d8e to your computer and use it in GitHub Desktop.
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
require 'data_objects' | |
require 'data_mapper' | |
require 'dm-core' | |
require 'dm-do-adapter' | |
require 'do_postgres' | |
module DataMapper | |
class << self | |
attr_accessor :query_count | |
end | |
class Repository | |
alias_method :original_new_query, :new_query | |
def new_query(model, options = {}) | |
DataMapper.query_count ||= 0 | |
DataMapper.query_count += 1 | |
original_new_query(model, options) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment