aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix duplicate table alias error when including an association with a ↵Rick Olson2008-03-261-25/+27
| | | | | | has_many :through association on the same join table. Closes #7310 [cavalle] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9095 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]Rick Olson2008-03-241-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one :through supports :source_type. Fix up some tests. References #4756.Jeremy Kemper2008-03-221-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow association scoping for built/created records if :conditions is ↵Rick Olson2008-03-211-3/+7
| | | | | | specified as a hash. Closes #11393 [miloops] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9068 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add has_one :through support, finally. Closes #4756 [thechrisoshow]Rick Olson2008-03-211-15/+41
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Docfixes (closes #11356, #11172, #10523)David Heinemeier Hansson2008-03-201-0/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve performance on :include/:conditions/:limit queries by selectively ↵Michael Koziarski2008-03-031-10/+27
| | | | | | joining in the pre-query. Closes #9560 [dasil003] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8977 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix that batched :include would pull in duplicate records in some cases. ↵Jeremy Kemper2008-02-281-2/+4
| | | | | | Closes #11215 [Catfish] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve associations performance by using symbol callbacks instead of string ↵Rick Olson2008-02-141-50/+90
| | | | | | callbacks. Closes #11108 [adymo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8867 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce the :readonly option to all associations. Records from the ↵Jeremy Kemper2008-02-131-5/+13
| | | | | | association cannot be saved. Closes #11084. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix eager loading with pre-quoted table names. Closes #11046 ↵Michael Koziarski2008-02-111-2/+2
| | | | | | [danielmorrison, Koz, Jeremy Kemper] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert r8742: remove has_many with :group option since it has sketchy sql ↵Jeremy Kemper2008-02-031-6/+0
| | | | | | support. Closes #10480. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make sure count works on has_many :through associations using :group. ↵Michael Koziarski2008-01-271-0/+6
| | | | | | Closes #10480 [remvee] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Indicate in documentation that newer version of AR support eager loading in ↵Marcel Molina2008-01-231-1/+5
| | | | | | polymorphic associations. Closes #10861 [fxn] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8707 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* belongs_to supports :dependent => :destroy and :delete. Closes #10592.Jeremy Kemper2008-01-191-0/+19
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8675 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce preload query strategy for eager :includes. Closes #9640.Jeremy Kemper2008-01-191-1/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8672 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Document that .build doesn't apply to has_many :through associations. Closes ↵Jeremy Kemper2008-01-051-1/+1
| | | | | | #10707 [GMFlash] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8562 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Document that eager loading doesn't work with polymorphic associations. ↵Jeremy Kemper2008-01-041-0/+17
| | | | | | Closes #10610 [Xavier Noria] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8556 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't unnecessarily load has_many associations in after_update callbacks. ↵Rick Olson2007-12-281-1/+5
| | | | | | Closes #6822 [stopdropandrew, canadaduane] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ruby 1.9 compat: fix warnings, shadowed block vars, and unitialized instance ↵Jeremy Kemper2007-12-221-189/+207
| | | | | | vars git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Eager belongs_to :include infers the foreign key from the association name ↵Jeremy Kemper2007-12-211-3/+3
| | | | | | rather than the class name. Closes #10517. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8456 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix typo in documentation for polymorphic associations w/STI. Closes #7461 ↵Marcel Molina2007-12-051-2/+2
| | | | | | [johnjosephbachir] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8305 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
* Fix that options[:from] table names should never be quoted [DHH]David Heinemeier Hansson2007-12-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8270 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that column names are quoted. Closes #10134 [wesley.moxam]Michael Koziarski2007-11-101-31/+48
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removed unused code (closes #9906)David Heinemeier Hansson2007-11-091-4/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8119 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Smattering of grammatical fixes to documentation. Closes #10083 [BobSilva]Marcel Molina2007-11-081-15/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Address shortcomings of changeset [8054] [protocool]David Heinemeier Hansson2007-11-071-73/+24
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Update association/method mapping table to refected latest collection ↵Marcel Molina2007-11-061-6/+6
| | | | | | methods for has_many :through. Closes #8772 [lifofifo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8102 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce finder :joins with associations. Same :include syntax but with ↵Jeremy Kemper2007-10-291-14/+89
| | | | | | inner rather than outer joins. Closes #10012. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8054 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Associations: speedup duplicate record check. Closes #10011.Jeremy Kemper2007-10-291-1/+28
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow association redefinition in subclasses. Closes #9346.Jeremy Kemper2007-10-271-2/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8046 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix has_many :through delete with custom foreign keys. Closes #6466.Jeremy Kemper2007-10-271-0/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Limited eager loading no longer ignores scoped :order. Closes #9561 [danger, ↵Marcel Molina2007-10-231-6/+4
| | | | | | josh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8006 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix regression where the association would not construct new finder SQL on ↵Jeremy Kemper2007-10-161-4/+4
| | | | | | save causing bogus queries for "WHERE owner_id = NULL" even after owner was saved. Closes #8713. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add notes to documentation regarding attr_readonly behavior with counter ↵Rick Olson2007-10-141-0/+3
| | | | | | caches and polymorphic associations. Closes #9835 [saimonmoore, rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7873 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that 'autosaving' works when associations aren't loaded [Bryan ↵Michael Koziarski2007-10-101-6/+9
| | | | | | Helmkamp] References #8713 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7824 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Update :dependent docs and improve its argument error message.Jeremy Kemper2007-10-091-34/+32
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7813 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* belongs_to infers the foreign key from the association name instead of from ↵Jeremy Kemper2007-10-081-1/+1
| | | | | | the class name. Fulfills the 1.2.4 deprecation. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7812 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't call attr_readonly on polymorphic belongs_to associations, in case it ↵Rick Olson2007-10-051-1/+1
| | | | | | matches the name of some other non-ActiveRecord class/module. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7748 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add attr_readonly to specify columns that are skipped during a normal ↵Rick Olson2007-09-301-1/+5
| | | | | | ActiveRecord #save operation. Closes #6896 [dcmanges] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7693 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed spelling errors (closes #9706) [tarmo/rmm5t]David Heinemeier Hansson2007-09-281-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7666 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Correctly quote id list for limited eager loading. Closes #7482.Jeremy Kemper2007-09-221-2/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7588 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Associations macros accept extension blocks alongside modules. Closes #9346.Jeremy Kemper2007-09-171-6/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Eager loading respects explicit :joins. Closes #9496.Jeremy Kemper2007-09-151-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove deprecated functionality from edge rails. Closes #9387 [lifofifo]Michael Koziarski2007-09-031-56/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7402 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Formatting, grammar and spelling fixes for the associations documentation. ↵Michael Koziarski2007-08-281-158/+158
| | | | | | [seanhussey] Closes #8899 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7368 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that eager loading queries and with_scope should respect the :group ↵David Heinemeier Hansson2007-08-211-4/+3
| | | | | | option [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7355 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that eager loading queries should respect the :group option as well [DHH]David Heinemeier Hansson2007-08-211-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7354 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* tiny doc patches [lifo]Rick Olson2007-07-251-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7236 5ecf4fe2-1ee6-0310-87b1-e25e094e27de