- 26 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
We have several test cases on "tricky" types that are essentially testing that `update_all` goes through the same type casting behavior as a normal assignment + save. We recently had another case to add this test for another type in https://github.com/rails/rails/pull/12742. Rather than testing this separately for every type which is "tricky" when round tripping, let's instead have a fairly exhaustive test that ensures we're getting the correct values at every step for `update_all`. Given the structure of the code now, we can be confident that if the type is correct, and `update_all` is type casting correctly, we're going to get the right behavior for all types.
-
- 18 6月, 2014 7 次提交
-
-
由 Matthew Draper 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
-
由 Sean Griffin 提交于
If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
-
由 Sean Griffin 提交于
HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
-
- 14 6月, 2014 2 次提交
-
-
由 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.
-
由 Sean Griffin 提交于
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
-
- 13 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
-
- 10 6月, 2014 3 次提交
-
-
由 Sean Griffin 提交于
``` activerecord/test/cases/adapters/postgresql/range_test.rb:159: warning: (...) interpreted as grouped expression activerecord/test/cases/finder_test.rb:38: warning: shadowing outer local variable - e activerecord/test/cases/finder_test.rb:43: warning: shadowing outer local variable - e ```
-
由 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
-
- 09 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
`serialize` is now lazy, so the workaround is no longer needed.
-
- 07 6月, 2014 3 次提交
-
-
由 Sean Griffin 提交于
The times would be equivalent, even if they were in different time zones. E.g. 12:00 UTC == 5:00 PDT
-
由 Sean Griffin 提交于
Millisecond inequality causes failures on Travis
-
由 Sean Griffin 提交于
-
- 06 6月, 2014 1 次提交
-
-
由 Yves Senn 提交于
This adds a regression test for #14411, which was fixed by #15503. Closes #14411 Closes #14595
-
- 05 6月, 2014 1 次提交
-
-
由 edogawaconan 提交于
BC era year is (astronomical year + 1) and starts from 1 BC.
-
- 04 6月, 2014 3 次提交
-
-
由 Sean Griffin 提交于
`@raw_attributes` should not contain the type-cast, mutable version of the value.
-
由 Aaron Patterson 提交于
-
由 Yves Senn 提交于
Revert "test pg, remove unused column assignments. Follow up to 254cdf47" Related to #15492 This reverts commit 254cdf47. This reverts commit 4bcf9029. There are public methods that assume `Column#default` is type casted. The return value of `Column#default` is publicly relevant and should not change. /cc @sgrif
-
- 03 6月, 2014 9 次提交
- 02 6月, 2014 2 次提交
-
-
由 Yves Senn 提交于
-
由 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 4 次提交
- 29 5月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
MySQL and PostgreSQL provide a column type override in order to properly type cast computed columns included in a result set. This should never override the known types of full fledged columns. In addition to messing up computed properties, this would have led to inconsistent behavior between a record created with `new`, and a record created with `last` on the mysql adapter in the following cases: - `tinyint(1)` with `emulate_booleans` set to `false` - `text`, `string`, `binary`, and `decimal` columns
-
- 28 5月, 2014 1 次提交
-
-
由 Yves Senn 提交于
The solution presented in this patch is not efficient. We should replace it in the near future. The following needs to be worked out: * Is `@attributes` storing the Ruby or SQL representation? * `cacheable_column?` is broken but `hstore` and `json` rely on that behavior Refs #15369. /cc @sgrif @rafaelfranca
-