diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-08-31 16:55:08 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-08-31 16:55:08 +0100 |
commit | 86c3dfbd47cb96af02daaa655963292b1a1b110e (patch) | |
tree | d04c70e51d360cab7f7719beb4b1d4ed2cde115b /activerecord/test | |
parent | e96558f8138d01ea64096f152f32c480af0861e6 (diff) | |
download | rails-86c3dfbd47cb96af02daaa655963292b1a1b110e.tar.gz rails-86c3dfbd47cb96af02daaa655963292b1a1b110e.tar.bz2 rails-86c3dfbd47cb96af02daaa655963292b1a1b110e.zip |
Key the attributes hash with symbols
This is a performance/GC optimisation.
In theory, this could be optimised by the implementation (last time I
checked, this would have no effect on JRuby). But in practise, this make
attribute access faster.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 1ea6f8295a..ea58a624a1 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -542,10 +542,10 @@ class AttributeMethodsTest < ActiveRecord::TestCase val = t.send attr_name unless attr_name == "type" if attribute_gets_cached assert cached_columns.include?(attr_name) - assert_equal val, cache[attr_name] + assert_equal val, cache[attr_name.to_sym] else assert uncached_columns.include?(attr_name) - assert !cache.include?(attr_name) + assert !cache.include?(attr_name.to_sym) end end end |