aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/write.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-11-14 20:12:17 +0100
committerJosé Valim <jose.valim@gmail.com>2011-11-14 20:12:17 +0100
commit9fa329b7544b15cdf5751d518e380abc82468df0 (patch)
treefacb557553e13712a87acaca21dae1220fda885e /activerecord/lib/active_record/attribute_methods/write.rb
parent2088f1b3b4538fc7cac0d7bb23bdfba592438a1d (diff)
downloadrails-9fa329b7544b15cdf5751d518e380abc82468df0.tar.gz
rails-9fa329b7544b15cdf5751d518e380abc82468df0.tar.bz2
rails-9fa329b7544b15cdf5751d518e380abc82468df0.zip
Speed up attribute invocation by checking if both name and calls are compilable.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods/write.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods/write.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb
index e9cdb130db..eb585ee906 100644
--- a/activerecord/lib/active_record/attribute_methods/write.rb
+++ b/activerecord/lib/active_record/attribute_methods/write.rb
@@ -10,7 +10,7 @@ module ActiveRecord
module ClassMethods
protected
def define_method_attribute=(attr_name)
- if attr_name =~ ActiveModel::AttributeMethods::COMPILABLE_REGEXP
+ if attr_name =~ ActiveModel::AttributeMethods::NAME_COMPILABLE_REGEXP
generated_attribute_methods.module_eval("def #{attr_name}=(new_value); write_attribute('#{attr_name}', new_value); end", __FILE__, __LINE__)
else
generated_attribute_methods.send(:define_method, "#{attr_name}=") do |new_value|