aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary scoping for creating hm:t join recordPratik Naik2009-08-101-3/+4
|
* Remove unnecessary scoping and validation checks from hm:t#createPratik Naik2009-08-101-1/+1
|
* Unify hm:t#create and create! implementationPratik Naik2009-08-101-17/+13
|
* raises an exception on habtm join table inserts if join table contains a ↵Jaime Bellmyer2009-08-091-2/+14
| | | | | | | | 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/+4
| | | | | | association creation if join table contains a primary key Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix that counter_cache breaks with has_many :dependent => :nullify.Gabe da Silveira2009-08-091-0/+1
| | | | | | [#1196 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* has_many :through create should not raise validation errorsrailsbob2009-08-091-1/+5
| | | | | | [#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-3/+9
| | | | 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-101-1/+1
| | | | | | model [#2719 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/+1
| | | | | | status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Ensure hm:t#find does not assign nil to :include [#1845 state:resolved]railsbob2009-08-091-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure hm:t#create/create! throws ActiveRecord::RecordNotSaved when the ↵Pratik Naik2009-08-081-0/+4
| | | | owner is new
* Merge docrailsPratik Naik2009-07-251-2/+2
|
* Add primary_key option to belongs_to associationSzymon Nowak2009-07-152-5/+27
| | | | | | [#765 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-014-28/+16
| | | | | | | | | 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-224-16/+28
| | | | | | | | 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-214-28/+16
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure hm:t#create respects source associations hash conditions [#2090 ↵mattbauer2009-06-211-0/+7
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* HasOneThroughAssociation still shouldn't derive from HasManyThroughAssociation.Adam Milligan2009-06-123-160/+164
| | | | | | [#1642 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* HasOneAssociation inherits AssociationProxy since it shares nothing with ↵Emilio Tagua2009-06-121-5/+5
| | | | | | | | BelongsToAssociation. [#2796 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ensure HasManyThroughAssociation#destroy delete orphan records [#2251 ↵Luca Guidi2009-05-181-0/+7
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Implement #many? for NamedScope and AssociationCollection using #size [#1500 ↵Chris Kampmeier2009-05-171-0/+9
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* has_one :through should not create a new association when assigned nil [#698 ↵Daniel Guettler2009-05-171-8/+8
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Revert "Fixed bug with polymorphic has_one :as pointing to an STI record"Jeremy Kemper2009-05-111-1/+1
| | | | | | [#2594 state:open] This reverts commit 99c103be1165da9c8299bc0977188ecf167e06a5.
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-046-9/+51
| | | | | | | | | | | | | | | | | | | | | | 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>
* Fixed bug with polymorphic has_one :as pointing to an STI recordRuy Asan2009-05-011-1/+1
| | | | | | [#2594 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ensure JoinAssociation uses aliased table name when multiple associations ↵Pratik Naik2009-04-201-2/+2
| | | | have hash conditions on the same table
* Merge docrailsPratik Naik2009-03-161-5/+9
|
* Ensure AutosaveAssociation runs remove callbacks [#2146 state:resolved]Luca Guidi2009-03-121-19/+32
| | | | | 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-1/+1
| | | | AssociationCollection#find_in_batches
* Ensure has_many :through works with changed primary keys [#736 state:resolved]Jim Remsik and Tim Pope2009-03-091-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix RDoc grammar and ensure hm:t tests can run in isolation. [#1644 ↵Adam Milligan2009-03-071-2/+2
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure replacing has_one associations respects the supplied :dependent ↵Dimitri Krassovski2009-03-061-2/+11
| | | | | | option. [#1305 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fixed that autosave should validate associations even if master is invalid ↵David Heinemeier Hansson2009-02-273-6/+6
| | | | [#1930 status:committed]
* Cache columns for has_and_belongs_to_many associationslukeludwig2009-01-171-3/+9
| | | | | This avoids repeatedly calling SHOW COLUMNS when the association is queried [#1738 state:committed]
* Fix HasManyAssociation#create ignoring the :primary_key option [#1633 ↵Roman Shterenzon2008-12-271-1/+4
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Fix has many through not quoting table names [#1163 state:resolved]Karthik Krishnan2008-12-201-3/+3
| | | | Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Fix preloading of has_one :through associations on belongs_to [#1507 ↵Matt Jones2008-12-181-1/+5
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Revert "Fix: counter_cache should decrement on deleting associated records."Jeremy Kemper2008-12-101-3/+0
| | | | | | [#1196 state:open] This reverts commit 05f2183747c8e75c9e8bbaadb9573b4bdf41ecfc.
* Fix: counter_cache should decrement on deleting associated records.Emilio Tagua2008-12-101-0/+3
| | | | | | [#1195 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Make NoMethodError message more descriptive when an undefined message has ↵Mike Ferrier2008-12-041-1/+4
| | | | | | been sent to an association [#1515 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add :having option to find, to use in combination with grouped finds. Also ↵miloops2008-12-011-0/+1
| | | | | | | added to has_many and has_and_belongs_to_many associations. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1028 state:committed]
* fix assignment to has_one :through associations.Matt Jones2008-11-151-4/+3
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Merge with docrails. Also add a rake task to generate guides in your rails ↵Pratik Naik2008-10-212-1/+8
| | | | | | | | application : rake doc:guides The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
* Ensure association proxy responds to private class methods defined in ↵Pratik Naik2008-10-161-2/+2
| | | | 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>
* Ensure methods called on association proxies respect access control. [#1083 ↵Pratik Naik2008-10-132-1/+12
| | | | state:resolved] [Adam Milligan, Pratik]
* Fix has_many :through when the source is a belongs_to association. [#323 ↵Zach Dennis2008-10-041-0/+11
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Try reloading model on class mismatch [#229 state:resolved]Lawrence Pit2008-10-041-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make AssociationCollection start transactions in the correct database.Hongli Lai (Phusion)2008-09-232-6/+21
| | | | | | | | | | 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]