| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Add a test case for overwriting existing condition on associations
|
| |
| |
| |
| |
| |
| |
| |
| | |
Overwriting existing condition on associations has already supported
(23bcc65 for eager loading, 2bfa2c0 for preloading).
Fixes #27724.
Closes #29154.
|
|/
|
|
|
| |
Since 07e5301, `Relation#first` will order by primary key if no order is
defined.
|
|
|
|
| |
Fixes #28324.
|
| |
|
|
|
|
| |
It is covered by following assertion.
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
|\
| |
| |
| | |
Enforce frozen string in Rubocop
|
| | |
|
|\ \
| | |
| | | |
Should be clear `@association_ids` when joined newly associated record
|
| |/
| |
| |
| | |
Fixes #29627.
|
|\ \
| |/
|/| |
Fix automatic inverse for polymorphic interfaces
|
| |
| |
| |
| | |
relationships when building objects on new records
|
| |
| |
| |
| |
| |
| |
| | |
This makes automatic inverse detection possible for polymorphic
:has_one & :has_many possible.
This resolves a number of issues, eg. `touch: true` on polymorphic relationships (#16446) and automatically setting inverse associations on newly built objects (#15028, #21843).
|
| |
| |
| |
| |
| |
| |
| | |
`aliased_table_name` in `Association` was added at a3502c4.
`aliased_table_name` in `JoinDependency` (added at 55854c4) is used, but
it looks like that added one in `Association` is never used from the
beginning.
|
|\ \
| | |
| | |
| | |
| | |
| | | |
kamipo/fix_eager_loading_to_respect_store_full_sti_class
Fix eager loading to respect `store_full_sti_class` setting
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
kamipo/dont_passing_klass_connection_to_association_scope
Don't passing `klass.connection` to `AssociationScope`
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Passing `klass.connection` is redundant because `AssociationScope` is
passed an association itself and an association has `klass`.
|
|\ \ \ \
| |_|/ /
|/| | | |
Add a test case for unscoping `default_scope` in associations
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Unscoping `default_scope` in associations has already supported (#17360
for preloading, c9cf8b8 for eager loading).
Fixes #20679.
Closes #16531.
|
|\ \ \
| |/ /
|/| | |
Use `reload` in `test_find_first_after_reload`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
And use `assert_same` instead of `assert_equal` and tiny fix assert
message s/#reload/#reset/.
Follow up of #29511.
|
|/ /
| |
| |
| |
| | |
If a record was built on a HasManyThroughAssociation, then removed, and
then the record was saved, the removed record would be created anyways.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `@offsets` cache is used by FinderMethods to cache records found by
find_nth. This cache is cleared in AR::Relation#reset, but not in
CollectionProxy#reset or CollectionProxy#reload.
Because of this, since #29098, calling #first/#find_nth/etc after
calling #reload or #reset on an association could return a stale record.
This is an issue both when the full association target is loaded and
when the item is loaded in #find_nth.
This commit solves the problem by clearing the `@offsets` cache in
CollectionProxy#reset and CollectionProxy#reload.
|
| |
| |
| |
| |
| |
| | |
A collection association will raise on `#create_association` when the parent is
unpersisted. A singular association should do the same. This addresses
issue #29219.
|
| |
| |
| |
| | |
These `assert_nothing_raised` are covered by following assertions.
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | | |
Fix association with extension issues
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes the following issues.
* `association_scope` doesn't include `default_scope`. Should use `scope` instead.
* We can't use `method_missing` for customizing existing method.
* We can't use `relation_delegate_class` for sharing extensions. Should extend per association.
|
|/ / |
|
|\ \
| | |
| | | |
Define path with __dir__
|
| | |
| | |
| | |
| | |
| | |
| | | |
".. with __dir__ we can restore order in the Universe." - by @fxn
Related to 5b8738c2df003a96f0e490c43559747618d10f5f
|
| | | |
|
|\ \ \
| | | |
| | | | |
Make helper methods in tests to private
|
| |/ /
| | |
| | |
| | |
| | | |
`make_model` and `make_no_pk_hm_t` in `HasManyThroughAssociationsTest`
are not a test case. it should be private.
|
|/ / |
|
| |
| |
| |
| | |
Fixes #29025.
|
| | |
|
| |
| |
| |
| |
| | |
This change reverted in eac6f369 but it is needed for data integrity.
See #25328.
|
|\ \
| | |
| | | |
Remove useless test case
|
| | |
| | |
| | |
| | |
| | | |
Cannot call private methods in `@klass` against `CollectionProxy`
(inherites `Relation`) because using `public_send` in `method_missing`.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2"
This reverts commit c1faca6333abe4b938b98fedc8d1f47b88209ecf, reversing
changes made to 8c658a0ecc7f2b5fc015d424baf9edf6f3eb2b0b.
See https://github.com/rails/rails/pull/27636#issuecomment-297534129
|
| |
| |
| |
| |
| |
| |
| | |
Follow up of 03d3f036.
Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036.
But the visibility is still public. It should be private.
|
| |
| |
| |
| | |
Fixes #24032
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
association saved in the callback
Related #18155, #26661, 268a5bb, #27434, #27442, and #28599.
Originally #18155 was introduced for preventing double insertion caused
by the after save callback. But it was caused the before save issue
(#26661). 268a5bb fixed #26661, but it was caused the performance
regression (#27434). #27442 added new record to `target` before calling
callbacks for fixing #27434. But it was caused double firing before save
callback (#28599). We cannot add new object to `target` before saving
the object.
This is improving #18155 to only track callbacks after `save`.
Fixes #28599.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
privileges (take 2)
Re-create https://github.com/rails/rails/pull/21233
eeac6151a5 was reverted (127509c071b4) because it breaks tests.
----------------
ref: 72c1557254
- We must use `authors` fixture with `author_addresses` because of its foreign key constraint.
- Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
|