aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
Commit message (Collapse)AuthorAgeFilesLines
* Remove the test which was testing a non-existing method, always failing on ↵Pratik Naik2010-01-021-6/+0
| | | | 1.9 and never even running on 1.8
* Oops. Remove debug information inside a test from the previous commitPratik Naik2009-12-291-2/+0
|
* Migrate all the calculation methods to RelationPratik Naik2009-12-291-0/+2
|
* Don't publicize with_scope for tests since it may shadow public misuseJeremy Kemper2009-12-281-4/+4
|
* Fix pg testJeremy Kemper2009-12-281-1/+2
|
* Make polymorphic_inverse_of in Reflection throw an ↵Murray Steele2009-12-281-2/+15
| | | | | | InverseOfAssociationNotFoundError if the supplied class doesn't have the appropriate association. [#3520 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Provide a slightly more robust we_can_set_the_inverse_on_this? method for ↵Murray Steele2009-12-281-1/+16
| | | | | | | | 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: Eloy Duran <eloy.de.enige@gmail.com>
* Add inverse polymorphic association support. [#3520 state:resolved]George Ogata2009-12-281-19/+81
| | | | Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Add more tests for the various ways we can assign objects to associations. ↵Murray Steele2009-12-281-11/+159
| | | | | | | | [#3513 state:resolved] Get rid of a duplicate set_inverse_instance call if you use new_record(true) (e.g. you want to replace the existing instance). Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Set inverse for #replace on a has_one association. [#3513 state:resolved]George Ogata2009-12-281-0/+15
| | | | Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Relation#readonly(false) should toggle the readonly flagPratik Naik2009-12-281-1/+1
|
* Remove unused construct_finder_sqlPratik Naik2009-12-281-14/+14
|
* Add Model.from and association_collection#from finder methodsPratik Naik2009-12-281-8/+1
|
* Add new finder methods to association collection.Pratik Naik2009-12-271-4/+4
|
* 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>
* Revert "Revert "Assert primary key does not exist in habtm when the ↵Jeremy Kemper2009-11-231-14/+2
| | | | | | | | | | | | | association is defined, instead of doing that everytime a record is inserted."" This reverts commit 2b82708b0efb3a3458e8177beab58f0c585788ae. [#3128 state:resolved] Conflicts: activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
* Insert generated association members in the same order they are specified ↵Gabe da Silveira2009-11-171-0/+22
| | | | | | | | when assigning to a has_many :through using the generated *_ids method [#3491 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>
* Merge branch 'associations_2'Emilio Tagua2009-10-051-1/+1
|\
| * Added eager loading support to Relation and ActiveRecord#all.Emilio Tagua2009-10-051-1/+1
| |
* | Merge commit 'rails/master'Emilio Tagua2009-10-021-0/+18
|\ \
| * | Make has_one with :conditions hash scope build or creation of the associated ↵Luciano G Panaro2009-09-281-0/+18
| | | | | | | | | | | | | | | | | | | | | object with those conditions Signed-off-by: Michael Koziarski <michael@koziarski.com> [#3088 state:committed]
* | | Merge commit 'rails/master'Emilio Tagua2009-09-141-0/+9
|\| |
| * | Fix has_one with foreign_key and primary_key association bug which caused ↵Graeme Porteous2009-09-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | the associated object being lost when saving the owner. [#1756 state:resolved] Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* | | Merge commit 'rails/master'Emilio Tagua2009-09-081-1/+1
|\| |
| * | 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>
* | | Merge commit 'rails/master'Emilio Tagua2009-09-081-2/+14
|\| | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * | Revert "Assert primary key does not exist in habtm when the association is ↵Jeremy Kemper2009-09-021-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | defined, instead of doing that everytime a record is inserted." Test failures on PostgreSQL. [#3128 state:open] This reverts commit da636809daca9c338200811d3590e446f57c8e81.
* | | Merge commit 'rails/master'Emilio Tagua2009-09-011-14/+2
|\| | | |/ |/| | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * Assert primary key does not exist in habtm when the association is defined, ↵José Valim2009-09-011-14/+2
| | | | | | | | | | | | | | | | instead of doing that everytime a record is inserted. [#3128 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* | Use finder options as relation method names to provide more familiarEmilio Tagua2009-08-181-5/+5
| | | | | | | | | | naming. Use bang methods convention in methods that alter the relation.
* | Merge commit 'rails/master'Emilio Tagua2009-08-171-1/+1
|\| | | | | | | | | Conflicts: activerecord/lib/active_record/calculations.rb
| * Fix test_has_many_through_polymorphic_has_one on sqlite2 [#3054 state:resolved]Jay Pignata2009-08-151-1/+1
| | | | | | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* | Merge commit 'rails/master'Emilio Tagua2009-08-111-0/+18
|\|
| * Add tests for hm:t#push failuresPratik Naik2009-08-111-0/+18
| |
* | Merge commit 'rails/master'Emilio Tagua2009-08-101-12/+8
|\|
| * Rewrite hm:t#create tests using assert_no_difference and assert_differencePratik Naik2009-08-101-12/+8
| |
* | Merge commit 'rails/master'Emilio Tagua2009-08-106-25/+171
|\| | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/calculations.rb activerecord/lib/active_record/connection_adapters/mysql_adapter.rb activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
| * raises an exception on habtm join table inserts if join table contains a ↵Jaime Bellmyer2009-08-091-1/+12
| | | | | | | | | | | | | | | | primary key. Caches this check to save time on subsequent inserts. [#2086 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
| * raises exception (ActiveRecord::ConfigurationError with message) on habtm ↵Jaime Bellmyer2009-08-091-0/+45
| | | | | | | | | | | | association creation if join table contains a primary key Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
| * Fix test dependency on taggingsJeremy Kemper2009-08-091-1/+2
| |
| * Fix that counter_cache breaks with has_many :dependent => :nullify.Gabe da Silveira2009-08-092-3/+28
| | | | | | | | | | | | [#1196 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
| * has_many :through create should not raise validation errorsrailsbob2009-08-091-1/+28
| | | | | | | | | | | | [#2934 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
| * 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>
| * Enable has_many :through for going through a has_one association on the join ↵Gabe da Silveira2009-08-103-2/+14
| | | | | | | | | | | | model [#2719 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
| * Removed duplicated tests [#3026 state:resolved]Arthur Zapparoli2009-08-101-18/+0
| | | | | | | | 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>