aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move non-type objects into the `Type::Helpers` namespaceSean Griffin2015-02-071-3/+0
| | | | | | | The type code is actually quite accessible, and I'm planning to encourage people to look at the files in the `type` folder to learn more about how it works. This will help reduce the noise from code that is less about type casting, and more about random AR nonsense.
* rm `ActiveRecord::Type::Decorator`Sean Griffin2015-02-071-1/+0
| | | | | | | It only existed to make sure the subclasses of `Delegator` were YAML serializable. As of Ruby 2.2, these are YAML dumpable by default, as it includes https://github.com/tenderlove/psych/commit/2a4d9568f7d5d19c00231cf48eb855cc45ec3394
* Push multi-parameter assignement into the typesSean Griffin2015-02-071-0/+1
| | | | | | | | | | | | This allows us to remove `Type::Value#klass`, as it was only used for multi-parameter assignment to reach into the types internals. The relevant type objects now accept a hash in addition to their previous accepted arguments to `type_cast_from_user`. This required minor modifications to the tests, since previously they were relying on the fact that mulit-parameter assignement was reaching into the internals of time zone aware attributes. In reaility, changing those properties at runtime wouldn't change the accessor methods for all other forms of assignment.
* Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.Ryuta Kamizono2014-12-121-0/+1
|
* Treat strings greater than int max value as out of rangeSean Griffin2014-10-311-0/+1
| | | | | | | | | | | Sufficiently large integers cause `find` and `find_by` to raise `StatementInvalid` instead of `RecordNotFound` or just returning `nil`. Given that we can't cast to `nil` for `Integer` like we would with junk data for other types, we raise a `RangeError` instead, and rescue in places where it would be highly unexpected to get an exception from casting. Fixes #17380
* Allow YAML serialization when using TZ aware attributesSean Griffin2014-09-171-0/+1
|
* Detect in-place changes on mutable AR attributesSean Griffin2014-06-131-0/+1
| | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-291-0/+1
| | | | | | | Many of the methods defined in `AttributeMethods::Serialization` can be refactored onto this type as well, but this is a reasonable small step. Removes the `Type` class, and the need for `decorate_columns` to handle serialized types.
* Move types to the top level `ActiveRecord` namespaceSean Griffin2014-05-271-0/+18
`ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value`