| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Remove deprecation warning
|
| | |
|
|\ \
| | |
| | | |
Ensure `column_types` returns a type object, and not a column
|
| |/ |
|
|/
|
|
|
| |
We are no longer including column objects in YAML serialization, thanks
to https://github.com/rails/rails/pull/15621
|
|\
| |
| | |
No need to decorate columns twice
|
| |
| |
| |
| |
| |
| |
| | |
We never want result types to override column types, and
`decorate_columns` can only affect column types. No need to go through
the decoration multiple times, we can just exclude the column types from
the result types instead.
|
| | |
|
|/ |
|
|\
| |
| | |
Fix warnings in tests
|
| |
| |
| |
| |
| |
| |
| |
| | |
```
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
```
|
|/
|
|
|
| |
On MySQL and PostgreSQL, the adapter does not type cast virtual columns
for us.
|
|\
| |
| | |
Inline PG array type casting helper
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Reflection has an available method that is used to check if the
reflection is a collection. Any :has_many macro is considered a
collection and `collection?` should be used instead of
`macro == :has_many`.
|
|\ \
| | |
| | | |
add has_one? method and reuse instead of checking macro
|
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of checking for `macro == :has_one` throughout the
codebase we can create a `has_one?` method to match the `belongs_to?`,
`polymorphic?` and other methods.
|
|\ \ \
| |/ /
|/| | |
Abstract away use of HABTM macro
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
By having the `:has_and_belongs_to_many` macro in the `@collection`
we are punishing `:has_many` associations because it has to allocate
the array and check the macro.
@collection is returned to `macro == :has_many` and a new reflection
class `HABTMReflection` is created to handle this case instead.
|
| |/
|/|
| |
| |
| |
| |
| | |
This reverts commit dd3ea17191e316aeebddaa7b176f6cfeee7a6365 and add a
regression test.
Fixes #15418
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Use an actual identity type in AR::Result#identity_type
|
| | |
| | |
| | |
| | |
| | | |
We should be able to rely on this object implenting the full type
interface.
|
|\ \ \
| | | |
| | | | |
Remove workaround for non-lazy serialize in tests
|
| |/ /
| | |
| | |
| | | |
`serialize` is now lazy, so the workaround is no longer needed.
|
|\ \ \
| | | |
| | | | |
Make `_before_type_cast` actually be before type cast
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- 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
|
| |/
|/|
| |
| |
| |
| |
| | |
Integration tests are inside protected_attributes test suite.
Fixes #15496
Fixes rails/protected_attributes#35
|
|/ |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| | |
Rename `property` to `attribute`
Conflicts:
activerecord/lib/active_record/attribute_methods/serialization.rb
activerecord/lib/active_record/base.rb
|
| |
| |
| |
| | |
For consistency with https://github.com/rails/rails/pull/15557
|
|\ \
| | |
| | | |
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
|
|\ \ \ \
| | | | |
| | | | | |
Do not type cast twice on attribute assignment
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Remove dead branch when restoring ID within a transaction
Conflicts:
activerecord/lib/active_record/transactions.rb
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
There is no way to have an instance of an Active Record model where
`has_attribute?(self.class.primary_key)` returns false. The record is
always initialized in such a way that `@raw_attributes` will have an id
key with nil for the value.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Reduces the number of places that care about the internals of how we
store and type cast attributes. We do not need to go through the
dup/freeze dance, as you couldn't have saved a frozen new record anyway,
and that is the only time we would end up modifying the frozen hash.
|
|/ / /
| | |
| | |
| | |
| | | |
Reduces the number of things outside of attribute methods that cares
about the details of how we store and type cast attributes
|
|\ \ \
| | | |
| | | | |
Specify a time zone when testing TZ aware attributes
|
| | |/
| |/|
| | |
| | | |
Millisecond inequality causes failures on Travis
|
|/ /
| |
| |
| |
| |
| | |
This is a follow up to #15556
@kuldeepaggarwal did submit this patch way back (#13624).
|
|\ \
| | |
| | | |
Add array support when time zone aware attributes are enabled
|
| | | |
|