Permalink
Browse files

Merge pull request #11971 from freerunningtechnologies/dynamic_respon…

…d_to

Performance regression in AR::Base.respond_to?
  • Loading branch information...
tenderlove committed Aug 22, 2013
2 parents 998d9c8 + 646bfe1 commit 744ed5c39381cb3e58eba6fab21f42b3408dce53
@@ -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
@@ -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

0 comments on commit 744ed5c

Please sign in to comment.