aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #7983 from georgebrock/bug7950-squashed"Carlos Antonio da Silva2013-01-151-7/+0
| | | | | | | | | | | This reverts commit 88a296dccc401da143d90cad54b693ff06bf2b58, reversing changes made to 666a7e34f553cef4c8878362eafc79c7e3f310c3. Conflicts: activerecord/CHANGELOG.md Reason: this has been resulting in some hard to track bugs and is introducing a possible breackage in a stable version.
* backport #8291, prevent mass assignment of polymorphic type with `build`Yves Senn2012-11-221-0/+8
| | | | | | | | | Closes #8265 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/associations/association.rb
* Test/changelog for has_many bug on unsaved recordsGeorge Brocklehurst2012-11-101-0/+7
| | | | | | | See issue #7950. The previous commit fixes this bug, and is a backport of 4bc2ae0da1dd812aee759f6d13ad428354cd0e13.
* Merge pull request #6978 from frodsan/count_nosql_unsaved_parentRafael Mendonça França2012-10-041-0/+6
| | | | Count returns 0 without querying if parent is not saved
* Revert "backport fair connection pool 02b2335563 to 3-2-stable"Rafael Mendonça França2012-09-201-2/+0
| | | | | | | | | | | | | This reverts commit 0693e079708a52b777f2b7872b8e3d467b880a0d. Revert "Cache columns metadata to avoid extra while testing" This reverts commit a82f1e3f5d11c8dfba9f4c911745ec40a7965216. Reason: This is causing failures in the postgresql build. See http://travis-ci.org/#!/rails/rails/builds/2485584 Related with #7675
* Cache columns metadata to avoid extra while testingRafael Mendonça França2012-09-181-0/+2
|
* Merge pull request #7666 from ↵Rafael Mendonça França2012-09-171-1/+1
| | | | | | kennyj/fix_9fa3f102813eeeec440abd75870dfa7b23835665 Fix warning: method redefine. Testcase name are duplicated.
* Merge pull request #7651 from steveklabnik/issue_3956Rafael Mendonça França2012-09-161-1/+31
| | | | | | | | | Don't preserve SELECT columns on COUNT Closes #7651 Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Revert "Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-011-19/+3
| | | | | | | | | | This reverts commit a79bfa92e7bdc31b346d13ee5447d3fdac382bfb. Conflicts: activerecord/CHANGELOG.md We shouldn't introducing deprecations in point releases. It will be deprecated in 4.0 instead.
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-201-3/+19
|
* Revert "Perf: Don't load the association for #delete_all."Jon Leighton2012-06-071-12/+0
| | | | | | | | | | This reverts commit b98d1e21635d8776de8893cc09bd86c71f6c78f0. Closes #6609 Conflicts: activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
* Ensure that CollectionAssociation#replace returns proper targetPiotr Sarnacki2012-05-191-2/+2
| | | | | | | | The fix commited in e2a070c was returning the `new_target`, as a try to return whatever user replaced association with. The problem is, the resulting association target may be ordered differently. In such case we want to return the target that will be later used for that association.
* Perf: Don't load the association for #delete_all.Jon Leighton2012-05-181-0/+12
| | | | | | | | Bug #6289 Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Fix CollectionAssociation#replace to return new target (closes #6231)Piotr Sarnacki2012-05-161-0/+12
| | | | | | Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Add order to tests that rely on db ordering, to fix failing tests on pgCarlos Antonio da Silva2012-03-221-5/+4
| | | | | | | Also skip persistente tests related to UPDATE + ORDER BY for postgresql PostgreSQL does not support updates with order by, and these tests are failing randomly depending on the fixture loading order now.
* Fix #5069 - Protect foreign key from mass assignment throught association ↵Jean Boussier2012-03-051-0/+22
| | | | builder
* Merge pull request #4543 from jdelStrother/find_or_initJon Leighton2012-02-011-0/+12
| | | | Don't instantiate two objects in collection proxy / find_or_instantiate_by
* Fix broken tests added by 85c724d59Rafael Mendonça França2012-01-311-10/+10
|
* Merge pull request #4783 from gregolsen/ids_reader_fixJon Leighton2012-01-311-0/+4
| | | | ids_reader method fixed, test added to has_many association (for PostgreSQL)
* Merge pull request #4216 from edgecase/master_fix_reorder_with_limited_idsAaron Patterson2011-12-281-0/+10
| | | | allow reorder to affect eager loading correctly
* load has_many associations keyed off a custom primary key if that key is ↵Brian Samson2011-11-251-1/+28
| | | | present but the record is unsaved
* Merge pull request #3507 from jmazzi/issue-3503Jeremy Kemper2011-11-031-0/+15
| | | | Preserve SELECT columns on the COUNT for finder_sql when possible
* Fixed failed test under 1.8.7 as map.keys order in indeterminableRocky Jaiswal2011-09-281-1/+1
|
* Merge pull request #3030 from htanata/fix_habtm_select_query_methodJon Leighton2011-09-261-0/+8
| | | | Fix: habtm doesn't respect select query method
* CollectionProxy#replace should change the DB records rather than just ↵Jon Leighton2011-09-261-0/+11
| | | | mutating the array. Fixes #3020.
* Ensure we are not comparing a string with a symbol in ↵Jon Leighton2011-09-061-0/+10
| | | | HasManyAssociation#inverse_updates_counter_cache?. Fixes #2755, where a counter cache could be decremented twice as far as it was supposed to be.
* Fixed CollectionAssociation#find to be compatible with Array#findBogdan Gusiev2011-07-051-0/+4
| | | | | In order to make CollectionAssociation behave closer to Array Add the ability to pass block to #find method just like Array#find does.
* Assign the association attributes to the associated record before the ↵Jon Leighton2011-06-301-0/+7
| | | | before_initialize callback of the record runs. Fixes #1842.
* Make assert_no_queries literally enforce that there are no queries. As in, ↵Jon Leighton2011-06-121-15/+0
| | | | not a single line of SQL should be sent to the database, not even stuff that is ignored by assert_queries. The argument being that if you write assert_no_queries, you really do not want there to be any queries.
* Refactor tests to be less brittleJon Leighton2011-06-121-25/+58
|
* Don't wrap operations on collection associations in transactions when they ↵benedikt2011-06-121-0/+45
| | | | are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database.
* 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.
* added an alias for new to build to the AR collection proxy, this corrects an ↵Josh Kalderimis2011-06-011-0/+10
| | | | issue where the collection proxies were not consistent
* Tests for issue #1360Farley Knight2011-05-311-0/+9
|
* Fix problem with loading polymorphic associations which have been defined in ↵Jon Leighton2011-05-221-0/+7
| | | | an abstract superclass. Fixes #552.
* Pass the attribute and option hashes to build_associationAndrew White2011-05-171-0/+13
| | | | | | | The build_association method was added as an API for plugins to hook into in 1398db0. This commit restores this API and the ability to override class.new to return a subclass based on a virtual attribute in the attributes hash.
* CollectionAssociation#merge_target_lists should write to the underlying ↵Jon Leighton2011-05-141-0/+10
| | | | attributes when copying, rather than using the assignment method
* Add test to specify that attributes from an association's conditions should ↵Jon Leighton2011-05-101-4/+23
| | | | be assigned without mass-assignment protection when a record is built on the association.
* Don't use mass-assignment protection when applying the ↵Jon Leighton2011-05-101-0/+9
| | | | scoped.scope_for_create. Fixes #481.
* Add failing tests according to #479.José Valim2011-05-101-0/+15
|
* Add failing tests, according to #480.José Valim2011-05-101-0/+14
|
* Fix for lighthouse #6741Nick Howard2011-05-011-0/+24
| | | | | | | - adds tests for find_or_create_by and find_or_initialize_by on has_many associations - changes the behavior of ActiveRecord::Associations::CollectionProxy#method_missing to differ to ActiveRecord::FinderMethods#find_or_instantiator_by_attributes for arg processing and saving so find_or_create_by's api on associations will be consistent w/ the api for model classes.
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-121-7/+7
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Added new #update_column method.Sebastian Martinez2011-03-271-3/+3
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Revert "Removed #update_attribute method. New #update_column method."Sebastian Martinez2011-03-271-3/+3
| | | | | | This reverts commit 45c233ef819dc7b67e259dd73f24721fec28b8c8. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Removed #update_attribute method. New #update_column method.Sebastian Martinez2011-03-261-3/+3
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-1/+0
| | | | ... } rather than instance_eval-ing strings
* Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-8/+14
| | | | 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.
* AssociationCollection#clear can basically just use #delete_all, except it ↵Jon Leighton2011-01-301-3/+6
| | | | should return self.