aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJohn Hawthorn <john@freerunningtechnologies.com>2013-08-20 19:27:17 -0700
committerJohn Hawthorn <john@freerunningtechnologies.com>2013-08-21 18:18:26 -0700
commit646bfe1a5e7b30863e5ab8a5927246be3a69ed3b (patch)
treecdf3eea3e490190ef60db06aaf18a526c3250643 /activerecord/lib
parent9208338b0f982e9776f29caeb46795c4cd9207a1 (diff)
downloadrails-646bfe1a5e7b30863e5ab8a5927246be3a69ed3b.tar.gz
rails-646bfe1a5e7b30863e5ab8a5927246be3a69ed3b.tar.bz2
rails-646bfe1a5e7b30863e5ab8a5927246be3a69ed3b.zip
Avoid compiling regexs in AR::Base.respond_to?
Caches the patterns of ActiveRecord::DynamicMatchers in a class instance variable.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/dynamic_matchers.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb
index 3bac31c6aa..e650ebcf64 100644
--- a/activerecord/lib/active_record/dynamic_matchers.rb
+++ b/activerecord/lib/active_record/dynamic_matchers.rb
@@ -35,7 +35,7 @@ module ActiveRecord
end
def pattern
- /^#{prefix}_([_a-zA-Z]\w*)#{suffix}$/
+ @pattern ||= /\A#{prefix}_([_a-zA-Z]\w*)#{suffix}\Z/
end
def prefix