aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change relation merging to always append select, group and order valuesPratik Naik2010-08-311-20/+5
|
* While creating a new record using has_many create method default scope of ↵Neeraj Singh2010-08-191-0/+19
| | | | | | | | | | | child should be respected. author.posts.create should take into account default_scope defined on post. [#3939: state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-2/+2
| | | | better default failure messages - let's use them
* fixed joining of attributes when using find_or_create_by with multiple ↵Jon Buda2010-07-281-0/+9
| | | | | | attributes through an association Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Remove unintentional API changes. [#1108]Pratik Naik2010-07-141-41/+9
|
* count method should not take options if it is operated on has_many ↵Neeraj Singh2010-07-131-0/+26
| | | | | | | | association which has finder_sql or counter_sql [#2395 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* renaming test name to fix accidently overrideSubba Rao Pasupuleti2010-07-131-1/+1
| | | | | | [#5076 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* fix ActiveRecord `destroy_all` so it returns destroyed recordsMislav Marohnić2010-07-081-2/+5
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* AssociationCollection#create_by_*, find_or_create_by_* work properly now. ↵Aaron Patterson2010-06-291-0/+62
| | | | | | [#1108 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* do order by id when finding first fixture to ensure that it is correct oneRaimonds Simanovskis2010-06-041-1/+1
| | | | (as otherwise was failing under JRuby and oracle_enhanced adapter)
* Use better assertion methods for testingNeeraj Singh2010-05-191-10/+3
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix for get_ids when including a belongs_to association on a has_many ↵Diego Algorta2010-05-151-0/+4
| | | | | | association [#2896 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add tests to prevent regression of lazy evaluation of has_many ..., ↵Andrew White2010-04-041-0/+18
| | | | | | | | :dependent => :___ [#2627 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Add :dependent = to has_one and has_many [#3075 state:resolved]Rizwan Reza2010-03-281-0/+8
|
* Fix associations to call :destroy or :delete based on the right :dependent ↵Carlos Antonio da Silva2010-03-091-19/+1
| | | | | | option Signed-off-by: José Valim <jose.valim@gmail.com>
* Forgot to revert tests from that last commitJoshua Peek2009-12-121-8/+0
|
* Revert "Fix instance_eval calls to association proxies"Joshua Peek2009-12-121-1/+0
| | | | | | | | | | I think it may of broke the build. Lets see. This reverts commit 49e943c4f0ac3459bd53023167aaa08fc8e46733. Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Fix postgresql AR test failureJohn Pignata2009-12-111-2/+2
| | | | | | | | Due to the ordering of the returning result set, the test fails under the postgresql adapter. Order results by id prior to checking the first item [#3542 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix instance_eval calls to association proxiesMat Brown2009-12-021-0/+8
| | | | | | | | In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly. [#3412 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* delete correct records for a has_many with :primary_key and :dependent => ↵Matt Jones2009-11-101-0/+12
| | | | | | :delete_all Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-1/+1
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Fix test dependency on taggingsJeremy Kemper2009-08-091-1/+2
|
* Fix that counter_cache breaks with has_many :dependent => :nullify.Gabe da Silveira2009-08-091-0/+25
| | | | | | [#1196 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Enable has_many :through for going through a has_one association on the join ↵Gabe da Silveira2009-08-101-1/+1
| | | | | | model [#2719 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make sure association conditions work with :include and :joins [#358 ↵Vladimir Meremyanin2009-08-091-0/+6
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Added back support for destroying an association's object by id. [#2306 ↵Joshua Nichols2009-08-091-0/+22
| | | | | | status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* added :order option to find :first methods and associations as otherwise ↵Raimonds Simanovskis2009-08-061-38/+42
| | | | | | | | Oracle tests were failing Oracle stores '' string as NULL Oracle cannot have identifiers larger than 30 characters added missing fixtures to test setup method
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-0/+5
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-5/+0
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-0/+5
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Implement #many? for NamedScope and AssociationCollection using #size [#1500 ↵Chris Kampmeier2009-05-171-0/+39
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure :dependent => :delete_all works for association with hash conditionsPratik Naik2009-04-201-0/+6
|
* Ensure AutosaveAssociation runs remove callbacks [#2146 state:resolved]Luca Guidi2009-03-121-0/+24
| | | | | Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add tests for AssociationCollection#find_each and ↵Pratik Naik2009-03-111-0/+39
| | | | AssociationCollection#find_in_batches
* Fix find_by_last when order is given [#2127 state:committed]Jan De Poorter2009-03-091-0/+4
| | | | Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-13/+13
| | | | [#1617 state:resolved]
* Fixed that autosave should validate associations even if master is invalid ↵David Heinemeier Hansson2009-02-271-129/+0
| | | | [#1930 status:committed]
* Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha.Jeremy Kemper2009-02-031-6/+4
|
* Make belongs_to :dependent => :destroy destroy self before associated ↵Ben VandenBos2009-01-161-1/+2
| | | | | | | | object [#1079 state:resolved] If foreign key constraints are in place then deleteing the associated object first will cause a foreign key violation Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Fix HasManyAssociation#create ignoring the :primary_key option [#1633 ↵Roman Shterenzon2008-12-271-0/+6
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Fix configure_dependency_for_has_many not quoting conditions properly [#1461 ↵Frederick Cheung2008-12-211-0/+13
| | | | state:resolved]
* Revert "Fix: counter_cache should decrement on deleting associated records."Jeremy Kemper2008-12-101-20/+0
| | | | | | [#1196 state:open] This reverts commit 05f2183747c8e75c9e8bbaadb9573b4bdf41ecfc.
* Fix: counter_cache should decrement on deleting associated records.Emilio Tagua2008-12-101-0/+20
| | | | | | [#1195 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Add :having option to find, to use in combination with grouped finds. Also ↵miloops2008-12-011-0/+5
| | | | | | | added to has_many and has_and_belongs_to_many associations. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1028 state:committed]
* Skip collection ids reader optimization if using :finder_sqlJeremy Kemper2008-10-231-0/+7
|
* Ensure association proxy responds to private class methods defined in ↵Pratik Naik2008-10-161-2/+8
| | | | associated class. [#1083]
* Allow class methods to be sent (via #send) to association proxy (fix for bug ↵Ian White2008-10-161-0/+4
| | | | | | introduced by 691aa20) [#1083] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix has_many :through when the source is a belongs_to association. [#323 ↵Zach Dennis2008-10-041-0/+1
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make AssociationCollection start transactions in the correct database.Hongli Lai (Phusion)2008-09-231-0/+9
| | | | | | | | | | AssociationCollection now starts transactions by calling AssociationCollection#transaction instead of @owner.transaction or @reflection.klass.transaction. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1081 state:committed]
* Association#first and last should not load the association if not needed. ↵Jan De Poorter2008-09-221-0/+13
| | | | | | [#1091 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>