aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_one_through_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Through associations should set both parent ids on join modelsSean Griffin2014-06-131-0/+14
| | | | | | | | | | | | | member = Member.new(club: Club.new) member.save! Before: member.current_membership.club_id # => nil After: member.current_membership.club_id # => club's id
* Raise `ArgumentError` when `has_one` is used with `counter_cache`Godfrey Chan2013-11-291-0/+8
| | | | | | | | | Previously, the `has_one` macro incorrectly accepts the `counter_cache` option due to a bug, although that options was never supported nor functional on `has_one` and `has_one ... through` relationships. It now correctly raises an `ArgumentError` when passed that option. For reference, this bug was introduced in 52f8e4b9.
* Unneeded assertionAkira Matsuda2013-07-291-1/+1
|
* make test not depend on orderNeeraj Singh2013-07-281-0/+1
| | | | | | | `NestedThroughAssociationsTest` adds records to `member_details` table. When test performs `@member_details[0]` then the order of record is not guaranteed. Hence it is best to start with a clean slate by deleting unwanted records.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-13/+13
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-7/+7
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* Deprecate update_column in favor of update_columns.Rafael Mendonça França2012-07-241-2/+2
| | | | Closes #1190
* remove deprecated callsJon Leighton2012-04-271-6/+6
|
* find and replace deprecated keysJon Leighton2012-04-271-7/+7
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-7/+7
| | | | things
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-3/+3
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-3/+3
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | 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.
* Don't use select() values from the join model of a through association. ↵Jon Leighton2011-05-111-0/+4
| | | | Fixes #508.
* Added new #update_column method.Sebastian Martinez2011-03-271-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Revert "Removed #update_attribute method. New #update_column method."Sebastian Martinez2011-03-271-2/+2
| | | | | | This reverts commit 45c233ef819dc7b67e259dd73f24721fec28b8c8. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Removed #update_attribute method. New #update_column method.Sebastian Martinez2011-03-261-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-7/+64
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb 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_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-181-2/+2
| |\ | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association.rb activerecord/lib/active_record/fixtures.rb
| | * Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-2/+2
| | | | | | | | | | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
| * | Run tests without IdentityMap when IM=false is given.Emilio Tagua2011-02-151-2/+2
| | |
| * | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-6/+57
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb 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/nested_attributes.rb activerecord/test/cases/relations_test.rb
| | * Get rid of set_association_target and association_loaded? as the parts of ↵Jon Leighton2011-01-111-1/+1
| | | | | | | | | | | | the code that need that can now just use association_proxy(:name).loaded?/target=
| | * Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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!
| | * If a has_many goes :through a belongs_to, and the foreign key of the ↵Jon Leighton2010-12-231-0/+15
| | | | | | | | | | | | belongs_to changes, then the has_many should be considered stale.
| | * Verify that has_one :through preload respects the :conditions [#2976 ↵Will Bryant2010-12-231-0/+12
| | | | | | | | | | | | state:resolved]
| | * Don't allow a has_one association to go :through a collection association ↵Jon Leighton2010-12-231-5/+7
| | | | | | | | | | | | [#2976 state:resolved]
| | * Fix for default_scope tests to ensure comparing of equally sorted listsRaimonds Simanovskis2010-12-231-1/+1
| |/ | | | | | | | | | | 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).
| * Respect the default_scope on a join model when reading a through associationJon Leighton2010-12-161-1/+9
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-12-121-0/+17
|\| | | | | | | | | | | | | | | 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
| * test case on has_one :through after a destroyJohn Hawthorn2010-11-291-0/+17
| | | | | | | | | | | | [#6037 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* | Fix naughty trailing whitespaceJon Leighton2010-10-311-6/+6
| |
* | Support for :primary_key option on the source reflection of a through ↵Jon Leighton2010-10-191-3/+9
| | | | | | | | association, where the source is a has_one or has_many
* | Respect the :primary_key option on the through_reflection of (non-nested) ↵Jon Leighton2010-10-191-1/+19
|/ | | | through associations
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-7/+7
| | | | 's/[ \t]*$//' -i {} \;)
* string IDs are now quoted correctly [#5064 state:resolved]Will St. Clair + Neeraj Singh2010-07-131-1/+11
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* This test never runs and it has never run. Since the day this fileNeeraj Singh2010-07-081-4/+0
| | | | | | | | was created this test has name not beginning with test_. Also this test is trying to use has_many on another has_many which is not supported. Signed-off-by: José Valim <jose.valim@gmail.com>
* Allow ho:through#build when the owner is a new record [#1749 state:resolved]Tristan Dunn2009-08-101-0/+10
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* has_one :through should not create a new association when assigned nil [#698 ↵Daniel Guettler2009-05-171-1/+8
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fixed autosave checks on objects with hm:t in :include [#2213 state:resolved]Will Bryant2009-03-121-0/+16
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-2/+2
| | | | [#1617 state:resolved]
* Fix preloading of has_one :through associations on belongs_to [#1507 ↵Matt Jones2008-12-181-1/+16
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* fix assignment to has_one :through associations.Matt Jones2008-11-151-1/+39
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Ensure methods called on association proxies respect access control. [#1083 ↵Pratik Naik2008-10-131-0/+10
| | | | state:resolved] [Adam Milligan, Pratik]
* Fix two has_one :through errorspivotal2008-08-271-0/+9
| | | | | | | | * Set the association target on assignment; * Reset target to nil on reset, rather than empty array. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#895 state:committed]
* Load the first and not the last has_one result when doing join-based eager ↵Tarmo Tänav2008-08-251-0/+10
| | | | | | | | | | | loading This matters when the has_one is defined with an order in which case there is an expectation that the first one will be loaded. [#904 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Implement old-skool eagerloading for has_one :throughFrederick Cheung2008-08-251-0/+16
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix preloading of has_one through associationsFrederick Cheung2008-08-251-5/+9
| | | | | | [#903 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Split associations_test.rb into multiple files based on association type. ↵Pratik Naik2008-04-061-0/+74
[Pratik] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de