- 03 10月, 2016 1 次提交
-
-
由 Iain Beeston 提交于
ActiveModel::Type) Some code was previously referring to ActiveModel::Type::*. This could cause issues in the future if any of the ActiveRecord::Type classes were overridden in the future.
-
- 07 8月, 2016 1 次提交
-
-
由 Xavier Noria 提交于
-
- 12 5月, 2016 1 次提交
-
-
由 Sean Griffin 提交于
When looking for mutation, we compare the serialized version of the value to the before_type_cast form. `Type::Serialized` was breaking this contract by passing the already serialized attribute to the subtype's mutation detection. This never manifested previously, as all mutable subtypes either didn't do anything in their `serialize` method, or had a way to detect double serialization (e.g. `is_a?(String)`). However, now that JSON types can handle string primitives, we need to avoid double serialization. Fixes #24993.
-
- 25 9月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
This moves a bit more of the logic required for dirty checking into the attribute objects. I had hoped to remove the `with_value_from_database` stuff, but unfortunately just calling `dup` on the attribute objects isn't enough, since the values might contain deeply nested data structures. I think this can be cleaned up further. This makes most dirty checking become lazy, and reduces the number of object allocations and amount of CPU time when assigning a value. This opens the door (but doesn't quite finish) to improving the performance of writes to a place comparable to 4.1
-
- 22 9月, 2015 1 次提交
-
-
由 Kir Shatrov 提交于
The first step of bringing typecasting to ActiveModel
-
- 23 3月, 2015 2 次提交
-
-
由 Matthew Draper 提交于
This is obviously all very internal, but sometimes you have to look at it... and when you do, it'll save a lot of confusion if it doesn't lie about its identity.
-
由 Matthew Draper 提交于
The subtype will (quite reasonably) ignore the possibility that it has `changed_in_place?` by becoming nil. Fixes #19467
-
- 18 2月, 2015 2 次提交
-
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
-
- 08 2月, 2015 2 次提交
-
-
由 Sean Griffin 提交于
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.
-
由 Sean Griffin 提交于
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
-
- 24 12月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
We were ignoring the `default_value?` escape clause in the serialized type, which caused the default value to always be treated as changed. Fixes #18169
-
- 14 11月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
There is a significant performance difference between the two. Closes
-
- 18 9月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
-
- 27 8月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
Fixes #16701
-
- 01 8月, 2014 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
Ruby generally does not use the is_* prefix on predicate methods.
-
- 14 6月, 2014 2 次提交
-
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
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.
-
- 10 6月, 2014 3 次提交
-
-
由 Sean Griffin 提交于
On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
-
由 Sean Griffin 提交于
In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
-
由 Sean Griffin 提交于
- The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
-
- 08 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
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.
-
- 06 6月, 2014 1 次提交
-
-
由 Yves Senn 提交于
This adds a regression test for #14411, which was fixed by #15503. Closes #14411 Closes #14595
-
- 03 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
The types know more about what is going on than the dirty module. Let's ask them!
-
- 02 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
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
-
- 30 5月, 2014 2 次提交
-
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
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.
-