aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute.rb
Commit message (Collapse)AuthorAgeFilesLines
* Implement `_was` and `changes` for in-place mutations of AR attributesSean Griffin2014-08-161-2/+6
|
* Implement `==` on `Type::Value` and `Attribute`Sean Griffin2014-08-151-0/+7
| | | | | This was a small self contained piece of the refactoring that I am working on, which required these objects to be comparable.
* Move writing unknown column exception to null attributeSean Griffin2014-06-261-0/+5
| | | | | | Making this change revealed several subtle bugs related to models with no primary key, and anonymous classes. These have been fixed as well, with regression tests added.
* `Attribute` should know about its nameSean Griffin2014-06-261-20/+27
| | | | | This allows using polymorphism for the uninitialized attributes raising an exception behavior.
* Encapsulate the creation of `Attribute` objectsSean Griffin2014-06-261-11/+17
| | | | | | | | This will make it less painful to add additional properties, which should persist across writes, such as `name`. Conflicts: activerecord/lib/active_record/attribute_set.rb
* Move behavior of `read_attribute` to `AttributeSet`Sean Griffin2014-06-251-0/+27
| | | | | | | | | | | | | | | Moved `Builder` to its own file, as it started looking very weird once I added private methods to the `AttributeSet` class and the `Builder` class started to grow. Would like to refactor `fetch_value` to change to ```ruby self[name].value(&block) ``` But that requires the attributes to know about their name, which they currently do not.
* add missing `:nodoc:` for recent refactorings. [ci skip]Yves Senn2014-06-241-3/+3
| | | | | | | | | | Adding `# :nodoc:` to the parent `class` / `module` is not going to ignore nested classes or modules. There is a modifier `# :nodoc: all` but sadly the containing class or module will continue to be in the docs. /cc @sgrif
* Refactor in-place dirty checking to use the attribute objectSean Griffin2014-06-161-0/+19
|
* Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-0/+56
There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types