aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
Commit message (Collapse)AuthorAgeFilesLines
...
| * Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-1/+9
| | | | | | | | | | | | | | | | 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-9/+1
| | | | | | | | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* | Leave the quoting part to ARelEmilio Tagua2009-06-121-150/+5
|\|
| * HasOneThroughAssociation still shouldn't derive from HasManyThroughAssociation.Adam Milligan2009-06-121-150/+5
| | | | | | | | | | | | [#1642 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* | Use ARel in SQL generation through associationsEmilio Tagua2009-06-101-4/+4
|/
* Ensure HasManyThroughAssociation#destroy delete orphan records [#2251 ↵Luca Guidi2009-05-181-0/+7
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* Fixed that autosave should validate associations even if master is invalid ↵David Heinemeier Hansson2009-02-271-2/+2
| | | | [#1930 status:committed]
* 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 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>
* Make AssociationCollection start transactions in the correct database.Hongli Lai (Phusion)2008-09-231-2/+2
| | | | | | | | | | 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]
* Add special AssociationReflection methods for creating association objects, ↵Hongli Lai (Phusion)2008-09-091-4/+5
| | | | | | | | and modify the code base to use those methods instead of creating association objects directly. This allows plugins to hook into association object creation behavior. [#986 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support.Ernie Miller2008-08-281-10/+0
| | | | | | [#831 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Use type_condition method for hmt STI conditionTarmo Tänav2008-08-151-1/+1
|
* Extract owner_quoted_id so it can be overridden. [#292 state:committed]Andre Arko2008-06-251-3/+3
|
* Add ActiveRecord::Base.sti_name that checks ↵rick2008-05-311-1/+1
| | | | ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [#114 state:resolved]
* Merge docrails.Pratik Naik2008-05-251-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* best solution?Steven Soroka2008-05-011-2/+2
| | | | Signed-off-by: Steven Soroka <ssoroka78@gmail.com>
* Remove duplicate code from associations. [Pratik]Pratik Naik2008-04-061-60/+10
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9231 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactor HasManyThroughAssociation to inherit from HasManyAssociation. ↵Pratik Naik2008-04-061-61/+32
| | | | | | Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add efficient #include? to AssociationCollection (for has_many/has_many ↵Rick Olson2008-04-011-1/+1
| | | | | | :through/habtm). [stopdropandrew] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_many :through would ignore the hash conditions (closes ↵David Heinemeier Hansson2008-03-281-2/+14
| | | | | | #11447) [miloops] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9110 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix issue where the :uniq option of a has_many :through association is ↵Rick Olson2008-03-261-5/+3
| | | | | | ignored when find(:all) is called. Closes #9407 [cavalle] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]Rick Olson2008-03-241-1/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]Pratik Naik2008-03-071-1/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve performance by avoiding named block arguments. Closes #11109 [adymo]Michael Koziarski2008-02-291-5/+19
| | | | | | | Reapplies [8865] with some fixes git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8957 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove dead code from hmt#delete. Closes #11236 [rubyruy]Jeremy Kemper2008-02-271-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8932 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make dynamic finders respect the :include on HasManyThrough associations. ↵Michael Koziarski2008-02-181-0/+1
| | | | | | Closes #10998. [cpytel] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert [8865], broke AP record identifier. Reopens #11109.Jeremy Kemper2008-02-151-7/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Minor formatting changesMichael Koziarski2008-02-141-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8869 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve associations performance by avoiding named block arguments. Closes ↵Rick Olson2008-02-141-5/+7
| | | | | | #11109 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert r8742: remove has_many with :group option since it has sketchy sql ↵Jeremy Kemper2008-02-031-9/+0
| | | | | | support. Closes #10480. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey ↵Jeremy Kemper2008-02-021-1/+1
| | | | | | Kondratenko] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make sure count works on has_many :through associations using :group. ↵Michael Koziarski2008-01-271-0/+9
| | | | | | Closes #10480 [remvee] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* More thoroughly quote table names. Exposes some issues with sqlite2 adapter. ↵Jeremy Kemper2008-01-051-8/+8
| | | | | | Closes #10698. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8571 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ruby 1.9 compat: fix warnings, shadowed block vars, and unitialized instance ↵Jeremy Kemper2007-12-221-6/+25
| | | | | | vars git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that the :uniq option for has_many :through associations retains the ↵Rick Olson2007-12-111-1/+2
| | | | | | order. #10463 [remvee] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix typos (closes #10378)David Heinemeier Hansson2007-12-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8301 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Dynamic finders on association collections respect association :limit. ↵Jeremy Kemper2007-11-211-1/+2
| | | | | | Closes #10227 [Jack Danger Canty] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make Dynamic Finders on Association Collections Respect Association :order ↵Michael Koziarski2007-11-211-1/+2
| | | | | | [patrick.t.joyce, technoweenie]. Closes #10211 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8174 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix HasManyThrough Association so it uses :conditions on the HasMany ↵Rick Olson2007-11-111-1/+2
| | | | | | Association. Closes #9729 [danger] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8128 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix has_many :through delete with custom foreign keys. Closes #6466.Jeremy Kemper2007-10-271-8/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Alias association #build to #new so it behaves predictably. Closes #8787.Jeremy Kemper2007-10-151-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7913 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make size for has_many :through use counter cache if it exists. Closes ↵Rick Olson2007-09-301-1/+11
| | | | | | #9734 [xaviershay] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7692 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Formatting, grammar and spelling fixes for the associations documentation. ↵Michael Koziarski2007-08-281-1/+1
| | | | | | [seanhussey] Closes #8899 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7368 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that has_many :through associations use a count query instead of ↵Rick Olson2007-07-251-0/+7
| | | | | | loading the target when #size is called. Closes #8800 [lifo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactored in use of extract_options! (closes #9079) [josh]David Heinemeier Hansson2007-07-241-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix #count on a has_many :through association so that it recognizes the ↵Rick Olson2007-07-201-0/+10
| | | | | | :uniq option. Closes #8801 [lifofifo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7199 5ecf4fe2-1ee6-0310-87b1-e25e094e27de