aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_assignment.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-07 08:56:27 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-07 11:46:58 -0600
commit368cca51d25fa15c0ddc8743b5904c4d5ce93e74 (patch)
tree3ee23e482c0167811cf8bb04c46a0cd6aa575911 /activerecord/lib/active_record/attribute_assignment.rb
parent2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b (diff)
downloadrails-368cca51d25fa15c0ddc8743b5904c4d5ce93e74.tar.gz
rails-368cca51d25fa15c0ddc8743b5904c4d5ce93e74.tar.bz2
rails-368cca51d25fa15c0ddc8743b5904c4d5ce93e74.zip
Do not type cast twice on attribute assignment
The definition of `write_attribute` in dirty checking ultimately leads to the columns calling `type_cast` on the value to perform the comparison. However, this is a potentially expensive computation that we cache when it occurs in `read_attribute`. The only case that we need the non-type-cast form is for numeric, so we pass that through as well (something I'm looking to remove in the future). This also reduces the number of places that manually access various stages in an attribute's type casting lifecycle, which will aid in one of the larger refactorings that I'm working on.
Diffstat (limited to 'activerecord/lib/active_record/attribute_assignment.rb')
0 files changed, 0 insertions, 0 deletions