- 26 1月, 2018 1 次提交
-
-
由 Daniel Colson 提交于
-
- 27 12月, 2017 1 次提交
-
-
由 Bogdan Gusiev 提交于
when model is added to collection association
-
- 12 12月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Follow up of #31390.
-
- 09 11月, 2017 4 次提交
-
-
由 Ben Toews 提交于
-
由 Ben Toews 提交于
-
由 Ben Toews 提交于
-
由 Bogdan Gusiev 提交于
-
- 18 8月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Otherwise random CI failure will be caused. https://travis-ci.org/rails/rails/jobs/265848046#L777
-
- 13 8月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
It is incorrect to treat `options[:primary_key]` as `association_primary_key` if `has_many` associations because the `:primary_key` means the column on the owner record, not on the association record. It will break `ids_reader` and `ids_writer`. ```ruby people(:david).essay_ids # => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David' ``` Fixes #14439.
-
- 20 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 13 7月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Since 07e5301e, `Relation#first` will order by primary key if no order is defined.
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 30 6月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Fixes #29627.
-
- 29 6月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Unscoping `default_scope` in associations has already supported (#17360 for preloading, c9cf8b8d for eager loading). Fixes #20679. Closes #16531.
-
- 28 6月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
And use `assert_same` instead of `assert_equal` and tiny fix assert message s/#reload/#reset/. Follow up of #29511.
-
- 22 6月, 2017 1 次提交
-
-
由 John Hawthorn 提交于
-
- 21 6月, 2017 1 次提交
-
-
由 John Hawthorn 提交于
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.
-
- 01 6月, 2017 1 次提交
-
-
由 Koichi ITO 提交于
-
- 28 5月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
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.
-
- 27 4月, 2017 3 次提交
-
-
由 Ryuta Kamizono 提交于
This change reverted in eac6f369 but it is needed for data integrity. See #25328.
-
由 Prathamesh Sonpatki 提交于
- Tried specifying `id` for the `readers` records but it is interconnected with so many tests that many random tests started failing. - So switched to the approach of deleting all readers in the `create_resets_cached_counters` test.
-
由 Rafael Mendonça França 提交于
Revert "Merge pull request #27636 from mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2" This reverts commit c1faca63, reversing changes made to 8c658a0e. See https://github.com/rails/rails/pull/27636#issuecomment-297534129
-
- 26 4月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Cannot call private methods in `@klass` against `CollectionProxy` (inherites `Relation`) because using `public_send` in `method_missing`.
-
- 22 4月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
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.
-
- 21 4月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Prevent double firing the before save callback of new object when the parent association saved in the callback Related #18155, #26661, 268a5bb0, #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). 268a5bb0 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.
-
- 20 4月, 2017 1 次提交
-
-
由 Fabian Schwahn 提交于
Add regression test for setting inverse instances on normal & polymorphic relationships when building objects on new records
-
- 26 3月, 2017 1 次提交
-
-
由 Fumiaki MATSUSHIMA 提交于
Re-create https://github.com/rails/rails/pull/21233 eeac6151 was reverted (127509c0) because it breaks tests. ---------------- ref: 72c15572 - 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.
-
- 19 3月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Since b644964b `ActiveRecord::Relation` includes `Enumerable` so delegating `collect`, `all?`, and `include?` are also unneeded. `collect` without block returns `Enumerable` without preloading by that. We should use `load` rather than `collect` for force loading.
-
- 09 3月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
The `select` in `QueryMethods` is also an enumerable method. Enumerable methods with block should delegate to `records` on `CollectionProxy`, not `scope`. Fixes #28348.
-
- 01 3月, 2017 1 次提交
-
-
由 eileencodes 提交于
I incorrectly changed behavior of `dup`. Reading the original issue I thought that `dup` should retain the original contents of the record and it's associations but it is in fact supposed to be a copy as if a record had been reinitialized. This reverts commit ca8c21df.
-
- 28 2月, 2017 1 次提交
-
-
由 eileencodes 提交于
In Rails 3.2 dupping a `CollectionProxy` would dup it's `load_target` as well. That functionality has been broken since the release of Rails 4.0. I hit this in an application upgrade and wondered why duplicating a CollectionProxy and assigning it to a variable stopped working. When calling `dup` on a `CollectionProxy` only the owner (ex. topic) was getting duplicated and the `load_target` would remain in tact with it's original object ID. Dupping the `load_target` is useful for performing a logging operation after records have been destroyed in a method. For example: ``` def transfer_operation saved_replies = topic.replies topic.replies.clear saved_replies.each do |reply| user.update_replies_count! end end ``` This change adds a `initialize_dup` method that performs a `deep_dup` on the `@associatiation` so that the `load_target` is dupped as well. Fixes #17117
-
- 08 2月, 2017 1 次提交
-
-
由 Klas Eskilson 提交于
Problem: Calling `count` on an association can cause invalid SQL queries to be created where the `SELECT COUNT(a, b, c)` function receives multiple columns. This will cause a `StatementInvalid` exception later on. Solution: Use `count(:all)`, which generates a `SELECT COUNT(*)...` query independently of the association. This also includes a test case that, before the fix, broke.
-
- 04 1月, 2017 1 次提交
-
-
由 Rafael Mendonça França 提交于
Revert "Merge pull request #21233 from mtsmfm/disable-referential-integrity-without-superuser-privileges" This reverts commit eeac6151, reversing changes made to 5c40239d. Reason: Broke the isolated tests. https://travis-ci.org/rails/rails/builds/188721346
-
- 30 12月, 2016 3 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
-
- 25 12月, 2016 2 次提交
-
-
由 Ryuta Kamizono 提交于
Because merging the association scope was removed.
-
由 Akira Matsuda 提交于
-
- 23 12月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
`append_record` was added at 15ddd517 for not double adding the record. But adding `append_record` (checking `@target.include?(record)`) caused performance regression #27434. Instead of checking not double adding the record, add a record to target before any callbacks loads the record. Fixes #27434.
-