| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things:
* Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted
* Use has_many if you actually want multiple associated objects
* Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g.
previous = obj.assoc
obj.create_assoc
previous.update_attributes(:obj_id => obj.id)
|
| | |
| | |
| | |
| | | |
there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations.
|
| | |
| | |
| | |
| | | |
removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
state:resolved]
This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct.
Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things.
Phew, long commit message!
|
| | |
| | |
| | |
| | | |
previously completely untested.
|
| | | |
|
| | |
| | |
| | |
| | | |
inherit from it
|
| | |
| | |
| | |
| | | |
:destroy, when the parent is destroyed, the callbacks are run
|
| | | |
|
| | |
| | |
| | |
| | | |
association [#6212 state:resolved]
|
| | |
| | |
| | |
| | | |
belongs_to changes, then the has_many should be considered stale.
|
| | |
| | |
| | |
| | | |
is fixed
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
optimisation has too many edge cases, such as when the reflection, source reflection, or through reflection has conditions, orders, etc. [#6153 state:resolved]
This reverts commit 373b053dc8b99dac1abc3879a17a2bf8c30302b5.
Conflicts:
activerecord/lib/active_record/associations.rb
|
| | |
| | |
| | |
| | | |
:through with :conditions, with a belongs_to as the source reflection
|
| | |
| | |
| | |
| | | |
times should append it to the @target multiple times [#5964 state:resolved]
|
| | |
| | |
| | |
| | | |
[#6089 state:resolved]
|
| | |
| | |
| | |
| | | |
belongs_to [#2990 state:resolved]
|
| | |
| | |
| | |
| | | |
state:resolved]
|
| | |
| | |
| | |
| | | |
[#2976 state:resolved]
|
| | |
| | |
| | |
| | |
| | |
| | | |
This is additional fix for commit
ebc47465a5865ab91dc7d058d2d8a0cc961510d7 Respect the default_scope on a join model when reading a through association
which otherwise was failing on Oracle (as it returned fixture comments in different order).
|
| | |
| | |
| | |
| | | |
a replacement
|
| | | |
|
| | |
| | |
| | |
| | | |
counter cache when deleting records
|
| | |
| | |
| | |
| | | |
goes :through a belongs_to [#2801 state:resolved]
|
| |\|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/persistence.rb
|
| | |
| | |
| | |
| | | |
[#2421 state:resolved]
|
| | |
| | |
| | |
| | | |
preloaded [#2447 state:resolved]
|
| | | |
|
| | |
| | |
| | |
| | | |
default_scope on the join model works correctly (creates the join record with the default scope applied)
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
store_full_sti_class is not supposed to change during "runtime".
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 4db9dca55e3acc2c59f252eb83ecb83db5f4b81b.
Conflicts:
activerecord/test/cases/identity_map_test.rb
|
| | |
| | |
| | |
| | | |
association proxy object.
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| | |/
| |/|
| | |
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/CHANGELOG
activerecord/lib/active_record/associations/class_methods/join_dependency.rb
activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
activerecord/lib/active_record/associations/has_many_through_association.rb
|
| | | |
|
| | |
| | |
| | |
| | | |
state:resolved]
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
[#6037 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|\| |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/CHANGELOG
activerecord/lib/active_record/associations.rb
|
| | | |
|
| |/
| |
| |
| | |
database_limits.rb
|
| | |
|
| |
| |
| |
| |
| | |
(default is nil meaning unlimited but Oracle imposes a limit of 1000)
Limit is used to make multiple queries when preloading associated has_many or habtm records
|