aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/numeric.rb
Commit message (Collapse)AuthorAgeFilesLines
* Further simplify `changed?` conditional for numeric typesSean Griffin2014-06-191-12/+6
| | | | | | | `Type::Integer.new.type_cast('') # => nil`, we do not need a special case to handle this, `nil => ''` already returns false. The only case we need to handle is `0 => 'wibble'` should be changed, while `0 => '0'` should not.
* Do not type cast twice on attribute assignmentSean Griffin2014-06-071-3/+3
| | | | | | | | | | | | | 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.
* Don't mess with `_before_type_cast` for numeric typesSean Griffin2014-06-061-7/+8
|
* Refactor determination of whether the field has changedSean Griffin2014-06-031-0/+23
| | | | | The types know more about what is going on than the dirty module. Let's ask them!
* Move types to the top level `ActiveRecord` namespaceSean Griffin2014-05-271-0/+18
`ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value`