提交 05a17dc6 编写于 作者: R Rick Olson

Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 f9cd92f4
*SVN*
* Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick]
* Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 [josh@hasmanythrough.com]
* Provide Association Extensions access to the instance that the association is being accessed from.
......
......@@ -56,9 +56,13 @@ def current_adapter?(type)
ActiveRecord::Base.connection.class.class_eval do
cattr_accessor :query_count
# Array of regexes of queries that are not counted against query_count
@@ignore_list = [/^SELECT currval/]
alias_method :execute_without_query_counting, :execute
def execute_with_query_counting(sql, name = nil)
self.query_count += 1
self.query_count += 1 unless @@ignore_list.any? { |r| sql =~ r }
execute_without_query_counting(sql, name)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册