aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/inverse_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* find and replace deprecated keysJon Leighton2012-04-271-9/+9
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-9/+9
| | | | things
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-18/+18
|
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-4/+4
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-4/+4
|
* 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.
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-39/+2
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* Don't not remove double negativesJon Leighton2011-01-071-1/+1
|
* fixing merge errorsAaron Patterson2011-01-041-67/+0
|
* Remove undocumented feature from has_one where you could pass false as the ↵Jon Leighton2011-01-031-7/+7
| | | | | | | | | | | | second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things: * Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted * Use has_many if you actually want multiple associated objects * Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g. previous = obj.assoc obj.create_assoc previous.update_attributes(:obj_id => obj.id)
* removing unused variablesAaron Patterson2010-11-221-2/+0
|
* removing many unused variablesAaron Patterson2010-11-161-2/+2
|
* Removed warnings when a variable is shadowedŁukasz Strzałkowski2010-07-191-2/+2
|
* Use better assertion methods for testingNeeraj Singh2010-05-191-9/+9
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* 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>
* honour :inverse_of for joins based includeFrederick Cheung2009-05-101-0/+28
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* honour inverse_of when preloading associationsFrederick Cheung2009-05-101-0/+33
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-0/+252
You can now add an :inverse_of option to has_one, has_many and belongs_to associations. This is best described with an example: class Man < ActiveRecord::Base has_one :face, :inverse_of => :man end class Face < ActiveRecord::Base belongs_to :man, :inverse_of => :face end m = Man.first f = m.face Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance. Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic. Signed-off-by: Murray Steele <muz@h-lame.com> Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>