Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #11971 from freerunningtechnologies/dynamic_respon…

…d_to

Performance regression in AR::Base.respond_to?
  • Loading branch information...
commit 744ed5c39381cb3e58eba6fab21f42b3408dce53 2 parents 998d9c8 + 646bfe1
@tenderlove tenderlove authored
View
2  activerecord/lib/active_record/dynamic_matchers.rb
@@ -35,7 +35,7 @@ def match(model, name)
end
def pattern
- /^#{prefix}_([_a-zA-Z]\w*)#{suffix}$/
+ @pattern ||= /\A#{prefix}_([_a-zA-Z]\w*)#{suffix}\Z/
end
def prefix
View
5 activerecord/test/cases/finder_respond_to_test.rb
@@ -21,6 +21,11 @@ def test_should_respond_to_find_by_one_attribute_before_caching
assert_respond_to Topic, :find_by_title
end
+ def test_should_respond_to_find_by_with_bang
+ ensure_topic_method_is_not_cached(:find_by_title!)
+ assert_respond_to Topic, :find_by_title!
+ end
+
def test_should_respond_to_find_by_two_attributes
ensure_topic_method_is_not_cached(:find_by_title_and_author_name)
assert_respond_to Topic, :find_by_title_and_author_name
Please sign in to comment.
Something went wrong with that request. Please try again.