| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\
| |
| | |
Don't query the database schema when calling `serialize`
|
| |
| |
| |
| |
| |
| | |
We need to decorate the types lazily. This is extracted to a separate
API, as there are other refactorings that will be able to make use of
it, and to allow unit testing the finer points more granularly.
|
|\ \
| | |
| | | |
Ensure time zones don't change after round trip with array columns
|
| | |
| | |
| | |
| | |
| | | |
The times would be equivalent, even if they were in different time
zones. E.g. 12:00 UTC == 5:00 PDT
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
This is a follow up to #15556
@kuldeepaggarwal did submit this patch way back (#13624).
|
|/ |
|
| |
|
|
|
|
|
| |
The types know more about what is going on than the dirty module. Let's
ask them!
|
|
|
|
|
|
|
|
|
|
|
| |
Nearly completely implemented in terms of custom properties.
`_before_type_cast` now stores the raw serialized string consistently,
which removes the need to keep track of "state". The following is now
consistently true:
- `model.serialized == model.reload.serialized`
- A model can be dumped and loaded infinitely without changing
- A model can be saved and reloaded infinitely without changing
|
|
|
|
|
|
| |
During `init_with`, the attributes given to the coder will be placed
into `@raw_attributes`. As such, we should read from `@raw_attributes`
when encoding, rather than `@attributes`, which has been type cast.
|
|
|
|
|
|
|
|
|
| |
`@attributes` was actually used for `_before_type_cast` and friends,
while `@attributes_cache` is the type cast version (and caching is the
wrong word there, but I'm working on removing the conditionals around
that). I opted for `@raw_attributes`, because `_before_type_cast` is
also semantically misleading. The values in said hash are in the state
given by the form builder or database, so raw seemed to be a good word.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Adds the ability to save custom types, which type cast to non-primitive
ruby objects.
|
|\
| |
| |
| |
| |
| |
| | |
Fix serialized field returning serialized data after update_column
Conflicts:
activerecord/CHANGELOG.md
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `:timestamp` type for columns is unused. All database adapters treat
them as the same database type. All code in `ActiveRecord` which changes
its behavior based on the column's type acts the same in both cases.
However, when the type is passed to code that checks for the `:datetime`
type, but not `:timestamp` (such as XML serialization), the result is
unexpected behavior.
Existing schema definitions will continue to work, and the `timestamp`
type is transparently aliased to `datetime`.
|
|/
|
|
|
|
|
|
| |
The second argument to serialize has double meaning:
* `class_name` of the Type to serialize
* `coder` to use then serializing.
The new variable name and the docs better describe that behavior.
|
|
|
|
|
|
| |
This is to ensure that they are not accidentally called by the app code.
They are renamed to _create_record and _update_record respectively.
Closes #11645
|
| |
|
|
|
|
| |
after loading it from YAML - fixes #13861
|
|\
| |
| | |
Better ActiveRecord hierarchy for Dirty and others
|
| |
| |
| | |
Move serialization dirty into serialization.rb
|
| | |
|
|/
|
|
| |
This will make easier to hook on this feature to customize the behavior
|
| |
|
|\ |
|
| |
| |
| |
| | |
See #8328
|
|/
|
|
|
|
| |
This is necessary because as of 5ac2341 `hstore` columns are always stored
as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to
be an instance of `HashWithIndifferentAccess`, which led to the bug.
|
|
|
|
| |
Make AM::Dirty less dirty to plugin into AR or other library
|
|\
| |
| | |
Perf: avoid dupes add fallback logic for coders
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Removed deprecated methods `partial_updates`, `partial_updates?` and
`partial_updates=`
|
| |
|
| |
|
| |
|
| |
|
| |
|