| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
https://github.com/rails/rails/commit/39542fba54328ca048fb75a5d5b37f8e1d4c1f37#commitcomment-8938379
|
| |
|
|\
| |
| | |
Fix ProtocolViolation/bind message for polymorphic + pluck or group+calc
|
| | |
|
|/ |
|
|\
| |
| | |
Add foreign_type option for polymorphic has_one and has_many.
|
| |
| |
| |
| |
| |
| |
| | |
To be possible to use a custom column name to save/read the polymorphic
associated type in a has_many or has_one polymorphic association, now users
can use the option :foreign_type to inform in what column the associated object
type will be saved.
|
|\ \
| | |
| | | |
Remove unused "Developer" fixtures from tests
|
| |/
| |
| |
| |
| | |
The `RecursiveCallbackDeveloper` and `ImmutableMethodDeveloper` classes
are not used anymore in tests, and neither is the `@cancelled` variable.
|
| |
| |
| |
| |
| |
| | |
The test added in 42418cfc94d1356d35d28d786f63e7fab9406ad6 wasn't
actually testing anything, since the bug was with TZ aware attributes
only.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
PostgreSQL for example, allows infinity as a valid value for date time
columns. The PG type has explicit handling for that case. However, time
zone conversion will end up trampling that handling. Unfortunately, we
can't call super and then convert time zones.
However, if we get back nil from `.in_time_zone`, it's something we
didn't expect so we can let the superclass handle it.
Fixes #17971
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`freeze` will ultimately end up freezing the `AttributeSet`, which in
turn freezes its `@attributes` hash. However, we actually insert a
special object to lazily instantiate the values of the hash on demand.
When it does need to actually instantiate all of them for iteration (the
only case is `ActiveRecord::Base#attributes`, which calls
`AttributeSet#to_h`), it will set an instance variable as a performance
optimization
Since it's just an optimization for subsequent calls, and that method
being called at all is a very uncommon case, we can just leave the ivar
alone if we're frozen, as opposed to coming up with some overly
complicated mechanism for freezing which allows us to continue to modify
ourselves.
Fixes #17960
|
|
|
|
|
|
|
|
|
|
| |
The user is able to pass PG string literals in 4.1, and have it
converted to an array. This is also possible in 4.2, but it would remain
in string form until saving and reloading, which breaks our
`attr = save.reload.attr` contract. I think we should deprecate this in
5.0, and only allow array input from user sources. However, this
currently constitutes a breaking change to public API that did not go
through a deprecation cycle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The validation added in 5a3dc8092d19c816b0b1203945639cb91d065847 will
reject values for the `:on` option for after_commit and after_rollback
callbacks that are string values like `"create"`.
However, the error message says ":on conditions for after_commit and
after_rollback callbacks have to be one of create,destroy,update". That
looks like a string value *would* be valid.
This commit changes the error message to say ":on conditions for
after_commit and after_rollback callbacks have to be one of [:create,
:destroy, :update]", making it clearer that symbols are required.
|
|
|
|
|
|
| |
If the tests are interupted and the teardown block doesn't run, the
developer needs to delete these manually in order to be able to run the
tests again.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The type registration was simply looking for the OID, and eagerly
fetching/constructing the sub type when it was registered. However,
numeric types have additional parameters which are extracted from the
actual SQL string of the type during lookup, and can have their behavior
change based on the result.
We simply need to use the block form of registration, and look up the
subtype lazily instead.
Fixes #17935
|
|\
| |
| | |
Remove deprecated behavior allowing nested arrays as query values
|
| | |
|
|/
|
|
|
|
|
|
|
| |
Active Record defines `attribute_method_suffix :?`. That suffix will
match any predicate method when the lookup occurs in Active Model. This
will make it incorrectly decide that `id_changed?` should not exist,
because it attempts to determine if the attribute `id_changed` is
present, rather than `id` with the `_changed?` suffix. Instead, we will
look for any correct match.
|
|
|
|
| |
Users should pass strings to queries instead of classes
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the following migration:
change_table(:table_name) { |t| t/timestamps }
The following error was produced:
wrong number of arguments (2 for 1) .... /connection_adapters/abstract/schema_statements.rb:851:in `remove_timestamps'
This is due to `arguments` containing an empty hash as its second
argument.
|
| |
|
|\
| |
| | |
Fix "nonexistent" typo in tests
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
This ensures that we're handling all forms of nested tables the same way.
We're aware that the `convert_dot_notation_to_hash` method will cause a
performance hit, and we intend to come back to it once we've refactored some of
the surrounding code.
[Melissa Xie & Melanie Gilman]
|
|
|
|
|
|
| |
This commit fixes the following case.
User.where(User.arel_table[:created_at].lteq(1.year.ago)).unscope(where :created_at)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This is a follow up to https://github.com/rails/rails/commit/07786c5e75a7b0afdf318063510af6b475e3e04c
and https://github.com/rails/rails/commit/cd2596f55e88fe659592612a793c4f4aa723c9be
|
| |
|
| |
|
|
|
|
| |
Fixes: https://github.com/rails/rails/issues/17856.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The detection of in-place changes caused a weird unexpected issue with
numericality validations. That validator (out of necessity) works on the
`_before_type_cast` version of the attribute, since on an `:integer`
type column, a non-numeric string would type cast to 0.
However, strings are mutable, and we changed strings to ensure that the
post type cast version of the attribute was a different instance than
the before type cast version (so the mutation detection can work
properly).
Even though strings are the only mutable type for which a numericality
validation makes sense, special casing strings would feel like a strange
change to make here. Instead, we can make the assumption that for all
mutable types, we should work on the post-type-cast version of the
attribute, since all cases which would return 0 for non-numeric strings
are immutable.
Fixes #17852
|
| |
|
|
|
|
|
|
|
|
| |
This fixes a regression where preloading association throws an
exception if one of the associations in the preloading hash doesn't
exist for one record.
Fixes #16070
|
|
|
|
|
|
| |
Since 3e30c5d, it started ignoring the given error message. This commit
changes the behavior of AR::RecordNotSaved#initialize so that it no
longer loses the given error message.
|
|\
| |
| | |
Correct test description for large integer test
|
| | |
|
|\ \
| | |
| | | |
Add #record attribute to RecordNotFound and RecordDestroyed exceptions.
|
| | |
| | |
| | |
| | | |
This allows these exceptions to be handled generically in conjunction with RecordInvalid.
|
|\ \ \
| | | |
| | | | |
Remove is_a? check when ignoring tables
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Technically changes the API, as it will allow any object which responds
to `===`. Personally, I think this is more flexible.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The records weren't being replaced since equality in Active Record is
defined in terms of `id` only. It is reasonable to expect that the
references would be replaced in memory, even if no queries are actually
executed. This change did not appear to affect any other parts of the
code base. I chose not to execute callbacks since we're not actually
modifying the association in a way that will be persisted.
Fixes #17730
|
| | | | |
|