aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_through_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove all revelant through records.Jon Leighton2011-11-031-0/+15
| | | | | | | | | If a record is removed from a has_many :through, all of the join records relating to that record should also be removed from the through association's target. (Previously the records were removed in the database, but only one was removed from the in-memory target array.)
* Fix adding multiple instances of the same record to a has_many :through.Jon Leighton2011-11-031-0/+10
| | | | Fixes #3425.
* Fix #3247.Jon Leighton2011-11-031-0/+5
| | | | | Fixes creating records in a through association with a polymorphic source type.
* The join_nodes must be passed to the JoinDependency initializer and ↵Jon Leighton2011-08-291-0/+4
| | | | therefore counted by the alias tracker. This is because the association_joins are aliased on initialization and then the tables are cached, so it is no use to alias the join_nodes later. Fixes #2556.
* Ensure empty has_many :through association preloaded via joins is marked as ↵Jon Leighton2011-08-151-0/+8
| | | | loaded. Fixes #2054.
* Fix bug in collection_singular_ids on has many through association with ↵Anatoliy Lysenko2011-07-061-0/+5
| | | | | | | | | | | | | | | | conditions and includes, when condtions references tables from includes. Test fail because of invalid sql: ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: comments.id: SELECT "posts".id FROM "posts" INNER JOIN "readers" ON "posts"."id" = "readers"."post_id" WHERE "readers"."person_id" = 1 AND (comments.id is null) Bug described in github#925 This commit will revert fix from https://github.com/rails/rails/commit/3436fdfc12d58925e3d981e0afa61084ea34736c , but tests is ok. Bug described in #6569 ticket.
* 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.
* add tests surrounding behavior of save and save! for associations that have ↵Aaron Patterson2011-05-241-0/+26
| | | | validation errors
* adding a test for create! with invalid associationsAaron Patterson2011-05-241-0/+9
|
* do not bother with assert_nothing_raised, the test will fail and we get a ↵Aaron Patterson2011-05-241-3/+1
| | | | better trace without it
* Add failing test case for issue 796Joey Butler2011-05-241-0/+9
|
* fixing more test warnings in 1.9.3Aaron Patterson2011-04-301-1/+1
|
* Fix test_associate_existing in has_many_through_associations_test on mysql ↵Jon Leighton2011-04-171-1/+1
| | | | and postgresql
* 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-14/+302
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Allow building and then later saving has_many :through records, such that ↵Jon Leighton2011-02-181-0/+18
| | | | | | | | the join record is automatically saved too. This requires the :inverse_of option to be set on the source association in the join model. See the CHANGELOG for details. [#4329 state:resolved]
| * Ensure that association_ids uses the correct attribute where the association ↵Jon Leighton2011-02-181-0/+10
| | | | | | | | is a has_many :through with a :primary_key option on the source reflection. [#6376 state:resolved]
| * Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-0/+7
| | | | | | | | ... } rather than instance_eval-ing strings
| * Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-2/+42
| | | | | | | | state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
| * Support the :dependent option on has_many :through associations. For ↵Jon Leighton2011-02-071-0/+100
| | | | | | | | historical and practical reasons, :delete_all is the default deletion strategy employed by association.delete(*records), despite the fact that the default strategy is :nullify for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association.
| * Make record.association.destroy(*records) on habtm and hm:t only delete ↵Jon Leighton2011-02-071-4/+8
| | | | | | | | records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry.
| * Has many through - It is not necessary to manually merge in the conditions ↵Jon Leighton2011-01-301-1/+11
| | | | | | | | hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions.
| * include_in_memory? should check against @target list in case of new records. ↵Aaron Patterson2011-01-121-0/+7
| | | | | | | | [#6257 state:resolved]
| * If a has_many goes :through a belongs_to, and the foreign key of the ↵Jon Leighton2010-12-231-0/+16
| | | | | | | | belongs_to changes, then the has_many should be considered stale.
| * Test to verify that #2189 (count with has_many :through and a named_scope) ↵Jon Leighton2010-12-231-0/+5
| | | | | | | | is fixed
| * Revert "Optimize <association>_ids for hm:t with belongs_to source". The ↵Jon Leighton2010-12-231-6/+2
| | | | | | | | | | | | | | | | | | | | 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
| * Test demonstrating problem with foo.association_ids where it's a has_many ↵Jon Leighton2010-12-231-0/+4
| | | | | | | | :through with :conditions, with a belongs_to as the source reflection
| * When a has_many association is not :uniq, appending the same record multiple ↵Jon Leighton2010-12-231-0/+10
| | | | | | | | times should append it to the @target multiple times [#5964 state:resolved]
| * Fix behaviour of foo.has_many_through_association.select('custom select') ↵Michał Łomnicki2010-12-231-0/+5
| | | | | | | | [#6089 state:resolved]
| * Fix creation of has_many through records with custom primary_key option on ↵Szymon Nowak2010-12-231-1/+29
| | | | | | | | belongs_to [#2990 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).
| * Fix problem where wrong keys are used in JoinAssociation when an association ↵Jon Leighton2010-12-201-0/+7
| | | | | | | | goes :through a belongs_to [#2801 state:resolved]
| * Fix problem with duplicated records when a :uniq :through association is ↵Jon Leighton2010-12-151-1/+7
| | | | | | | | preloaded [#2447 state:resolved]
| * Verify that creating a has_many through record where there is a ↵Jon Leighton2010-12-161-0/+7
| | | | | | | | default_scope on the join model works correctly (creates the join record with the default scope applied)
| * Respect the default_scope on a join model when reading a through associationJon Leighton2010-12-161-0/+4
| |
| * Fix hm:t to self table aliasing in construct_scopeErnie Miller2010-12-161-1/+1
| |
| * add test which fails for has_many through self join [#4361 state:open]Joe Hannon2010-12-161-0/+7
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-271-1/+0
|\| | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb
| * removing unused variablesAaron Patterson2010-11-221-1/+0
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-171-0/+7
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb
| * Fix bug where size of through association is not correct after adding a ↵Jason Cheow2010-11-141-0/+7
| | | | | | | | | | | | | | | | has_many association (occurs only before main object has been reloaded). [#5968 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* | Fix naughty trailing whitespaceJon Leighton2010-10-311-5/+5
| |
* | 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/+18
|/ | | | through associations
* AssociationCollection#include? working properly for objects added with build ↵Marcelo Giorgi2010-09-301-0/+14
| | | | method [#3472 state:resolved]
* Set attributes properly for model built from association with conditions ↵Marcelo Giorgi2010-09-281-0/+14
| | | | | | [#5562 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)