aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/write.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-07-19 17:09:13 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-07-19 17:09:13 -0600
commitf91439d848b305a9d8f83c10905e5012180ffa28 (patch)
tree45c01f22da71b298dd2ea0ac3811adfb563d4ee5 /activerecord/lib/active_record/attribute_methods/write.rb
parente19acbb8831e214eb38d589bf8c424edf80c2970 (diff)
parent5bb1d4d288d019e276335465d0389fd2f5246bfd (diff)
downloadrails-f91439d848b305a9d8f83c10905e5012180ffa28.tar.gz
rails-f91439d848b305a9d8f83c10905e5012180ffa28.tar.bz2
rails-f91439d848b305a9d8f83c10905e5012180ffa28.zip
Merge pull request #20946 from schneems/schneems/let-it-go
Freeze string literals when not mutated.
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 ab017c7b54..07d5e7d38e 100644
--- a/activerecord/lib/active_record/attribute_methods/write.rb
+++ b/activerecord/lib/active_record/attribute_methods/write.rb
@@ -24,7 +24,7 @@ module ActiveRecord
protected
def define_method_attribute=(name)
- safe_name = name.unpack('h*').first
+ safe_name = name.unpack('h*'.freeze).first
ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1