- 25 10月, 2015 1 次提交
-
-
由 Sebastian McKenzie 提交于
-
- 27 9月, 2015 1 次提交
-
-
由 eileencodes 提交于
`inverse_of` on through associations was accidently removed/caused to stop working in commit f8d2899d which was part of a refactoring on `ThroughReflection`. To fix we moved `inverse_of` and `check_validity_of_inverse!` to the `AbstractReflection` so it's available to the `ThroughReflection` without having to dup any methods. We then need to delegate `inverse_name` method in `ThroughReflection`. `inverse_name` can't be moved to `AbstractReflection` without moving methods that set the instance variable `@automatic_inverse_of`. This adds a test that ensures that `inverse_of` on a `ThroughReflection` returns the correct class name, and the correct record for the inverse relationship. Fixes #21692
-
- 16 6月, 2014 1 次提交
-
-
由 Andrew McCloud 提交于
-
- 11 6月, 2014 1 次提交
-
-
由 Andrew S. Brown 提交于
use name specified by 'as' for automatic inverse association to avoid reflecting on wrong association
-
- 05 6月, 2014 1 次提交
-
-
由 Leandro Facchinetti 提交于
`InverseHasManyTests#test_parent_instance_should_be_shared_within_create_block_of_new_child` was mistakenly the same as `InverseHasManyTests#test_parent_instance_should_be_shared_within_build_block_of_new_child`.
-
- 14 10月, 2013 1 次提交
-
-
由 Dmitry Polushkin 提交于
check at association reader that record is inverted and should not be reloaded because of stale was changed at target record
-
- 05 10月, 2013 1 次提交
-
-
由 Arthur Neves 提交于
-
- 15 8月, 2013 1 次提交
-
-
由 wangjohn 提交于
Currently, ActiveRecord models with multiple words cannot have their inverse associations detected automatically.
-
- 13 8月, 2013 1 次提交
-
-
由 Rajarshi Das 提交于
-
- 22 6月, 2013 2 次提交
-
-
由 Neeraj Singh 提交于
currently `post.comments.find(Comment.first.id)` would load all comments for the given post to set the inverse association. This has a huge performance penalty. Because if post has 100k records and all these 100k records would be loaded in memory even though the comment id was supplied. Fix is to use in-memory records only if loaded? is true. Otherwise load the records using full sql. Fixes #10509
-
由 Neeraj Singh 提交于
PR https://github.com/rails/rails/pull/10566 had to be reverted because after applying the fix test "test_raise_record_not_found_error_when_invalid_ids_are_passed" started failing. In this test invalid_id is being assigned a really large number which was causing following failure when PR #10566 was applied. ``` RangeError: bignum too big to convert into `long long' SELECT `interests`.* FROM `interests` WHERE `interests`.`man_id` = ? AND `interests`.`id` = ? LIMIT 1 [["man_id", 970345987], ["id", 2394823094892348920348523452345]] ``` This test is not failing in master because when test code `man.interests.find(invalid_id)` is executed then interests are fully loaded in memory and no database query is executed. After PR #10566 was merged then test code `man.interests.find(invalid_id)` started executing sql query and hence the error. In case someone is wondering why the second part of query is not failing, then that's because the actual query does not require any variable substituation where the number is large. In that case the sql generate is following. ``` SELECT `interests`.* FROM `interests` WHERE `interests`.`man_id` = ? AND `interests`.`id` IN (8432342, 2390102913, 2453245234523452) [["man_id", 970345987]] ```
-
- 19 6月, 2013 2 次提交
-
-
由 Jon Leighton 提交于
This reverts commit 2b817a5e, reversing changes made to 353a398b. Conflicts: activerecord/CHANGELOG.md Reason: the build broke
-
由 Neeraj Singh 提交于
currently `post.comments.find(Comment.first.id)` would load all comments for the given post to set the inverse association. This has a huge performance penalty. Because if post has 100k records and all these 100k records would be loaded in memory even though the comment id was supplied. Fix is to use in-memory records only if loaded? is true. Otherwise load the records using full sql. Fixes #10509
-
- 08 5月, 2013 1 次提交
-
-
由 wangjohn 提交于
the results. Added tests to check to make sure that inverse associations are automatically found when has_many, has_one, or belongs_to associations are defined.
-
- 02 4月, 2013 2 次提交
- 01 4月, 2013 1 次提交
-
-
由 Michal Cichra 提交于
This fixes inconsistency when building children of association which has inverse_of set properly. When creating new association object with a block: parent.association.build do |child| child.parent.equal?(parent) # false end So the block the `child.parent` did not point to the same object. But when the object is created it points to same instance: child = parent.association.build child.parent.equal?(parent) # true
-
- 20 3月, 2013 1 次提交
-
-
由 wangjohn 提交于
if the association already holds that record in memory before checking the database for the specified ids.
-
- 02 11月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
When calling first(n) or last(n) in a collection, Active Record was improperly trying to set the inverse of instance in case that option existed. This change was introduced by fdf4eae5. In such cases we don't need to do that "manually", since the way collection will be loaded will already handle that, so we just skip setting the inverse association when any argument is given to first(n)/last(n). The test included ensures that these scenarios will have the inverse of instance set properly. Fixes #8087, Closes #8094. Squashed cherry-pick from d37d40b2 and c368b660. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/associations/collection_association.rb
-
- 18 8月, 2012 1 次提交
-
-
由 brainopia 提交于
-
- 28 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
-
- 27 4月, 2012 3 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 17 1月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
This reverts commit c99d507f.
-
- 29 12月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
-
- 07 6月, 2011 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 05 6月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
-
- 18 2月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
Split AssociationProxy into an Association class (and subclasses) which manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
-
- 08 1月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
-
- 05 1月, 2011 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 04 1月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
Remove undocumented feature from has_one where you could pass false as the 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)
-
- 23 11月, 2010 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 17 11月, 2010 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 19 7月, 2010 1 次提交
-
-
由 Łukasz Strzałkowski 提交于
-
- 19 5月, 2010 1 次提交
-
-
由 Neeraj Singh 提交于
[#4645 state:resolved] Signed-off-by: NJosé Valim <jose.valim@gmail.com>
-
- 29 12月, 2009 1 次提交
-
-
由 Jeremy Kemper 提交于
-
- 28 12月, 2009 3 次提交
-
-
由 Murray Steele 提交于
Make polymorphic_inverse_of in Reflection throw an InverseOfAssociationNotFoundError if the supplied class doesn't have the appropriate association. [#3520 state:resolved] Signed-off-by: NEloy Duran <eloy.de.enige@gmail.com>
-
由 Murray Steele 提交于
Provide a slightly more robust we_can_set_the_inverse_on_this? method for polymorphic belongs_to associations. [#3520 state:resolved] Also add a new test for polymorphic belongs_to that test direct accessor assignment, not just .replace assignment. Signed-off-by: NEloy Duran <eloy.de.enige@gmail.com>
-
由 George Ogata 提交于
Signed-off-by: NEloy Duran <eloy.de.enige@gmail.com>
-