aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Change belongs_to so that the foreign_key assumption is taken from the ↵Rick Olson2007-07-161-6/+0
| | | | | | association name, not the class name. Closes #8992 [hasmanyjosh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Define collection singular ids method for has_many :through associations. ↵Jeremy Kemper2007-06-271-2/+3
| | | | | | Closes #8763. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7137 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix polymorphic has_one associations declared in an abstract class. Closes ↵Jeremy Kemper2007-06-251-9/+1
| | | | | | #8638. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7119 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Save associated records only if the association is already loaded. Closes #8713.Jeremy Kemper2007-06-211-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove deprecated find_first and find_all.Jeremy Kemper2007-06-111-1/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Quickref for association methods. Closes #7723.Jeremy Kemper2007-05-301-3/+40
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6905 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that associations with :dependent => :delete_all respect :conditions ↵Rick Olson2007-05-241-4/+5
| | | | | | option. Closes #8034 [danger, joshpeek, Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6827 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix :through docs wrecked up by [6777]. Closes #4961.Jeremy Kemper2007-05-231-1/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* belongs_to assignment creates a new proxy rather than modifying its target ↵Jeremy Kemper2007-05-221-4/+1
| | | | | | in-place. Closes #8412. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6804 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Document deep eager includes. Closes #6267.Jeremy Kemper2007-05-191-1/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* belongs_to doesn't go :through. Closes #4961.Jeremy Kemper2007-05-181-2/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6777 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Docs: warn that associations names shouldn't be reserved words. Closes #4378.Jeremy Kemper2007-05-181-0/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6770 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Update documentation for :dependent declaration so that it explicitly uses ↵Marcel Molina2007-05-061-1/+1
| | | | | | the non-deprecated API. Closes #8069. [danger] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6686 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* documentation project patches, closes #7342, #7319, #7316, #7190 ↵Rick Olson2007-03-271-1/+8
| | | | | | [jeremymcanally] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6470 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix method visibility bug uncovered by #7854.Jeremy Kemper2007-03-181-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6442 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* trim the fatRick Olson2007-03-131-44/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6411 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow a polymorphic :source for has_many :through associations. Closes ↵Rick Olson2007-03-131-46/+110
| | | | | | #7143 [protocool] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6408 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Nodoc the irrelevant (from 1.2)David Heinemeier Hansson2007-01-261-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6044 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove useless code in #attribute_present? since 0 != blank?. Closes #7249 ↵Rick Olson2007-01-231-2/+2
| | | | | | [Josh Susser]. Fix minor doc typos. Closes #7157 [Josh Susser] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix incorrect usage of #classify when creating the eager loading join ↵Rick Olson2007-01-231-5/+5
| | | | | | statement. Closes #7044 [Josh Susser] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates ↵Rick Olson2007-01-161-1/+7
| | | | | | the default join table name. #7072 [jeremymcanally] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5960 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve association documentation, closes #7022. [hasmanyjosh]Michael Koziarski2007-01-151-1/+65
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5939 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* PostgreSQL: use a subselect to correctly perform eager finds with :limit and ↵Jeremy Kemper2007-01-121-1/+7
| | | | | | :order. Closes #4668. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5887 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Subclass instantiation doesn't try to explicitly require the corresponding ↵Jeremy Kemper2006-12-191-4/+0
| | | | | | subclass. Closes #6840. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5751 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix faulty inheritance tests and that eager loading grabs the wrong ↵Rick Olson2006-12-191-1/+1
| | | | | | inheritance column when the class of your association is an STI subclass. Closes #6859 [protocool] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5744 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* find supports :lock with :include. Check whether your database allows SELECT ↵Jeremy Kemper2006-12-051-0/+1
| | | | | | ... FOR UPDATE with outer joins before using. Closes #6764. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Oracle: fix limited id selection for eager loading. Closes #6515.Jeremy Kemper2006-11-101-6/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Cache inheritance_column. Closes #6592.Jeremy Kemper2006-11-091-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Find with :include respects scoped :order. Closes #5850.Jeremy Kemper2006-11-071-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5445 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one :dependent => :nullify ignores nil associates. Closes #6528.Jeremy Kemper2006-11-021-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5401 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix has_many :through to add the appropriate conditions when going through ↵Rick Olson2006-10-161-5/+15
| | | | | | an association using STI. Closes #5783. [Jonathan Viney] (sorry, forgot to commit the actual files) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5310 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* automatically add primary key to #select_limited_ids_list order by clause ↵Rick Olson2006-10-131-0/+1
| | | | | | for databases that require order columns in the distinct statements (postgresql) [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5292 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix select_limited_ids_list issues in postgresql, retain current behavior in ↵Rick Olson2006-10-131-4/+9
| | | | | | other adapters [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5291 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Restore eager condition interpolation, document it's differences [Rick]Rick Olson2006-10-111-3/+7
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5284 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Reverted old select_limited_ids_list postgresql fix that caused issues in ↵Rick Olson2006-10-091-3/+2
| | | | | | mysql. Closes #5851 [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5265 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removes the ability for eager loaded conditions to be interpolated, since ↵Rick Olson2006-10-091-21/+11
| | | | | | there is no model instance to use as a context for interpolation. #5553 [turnip@turnipspatch.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5264 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Docfix (closes #6040)David Heinemeier Hansson2006-10-091-0/+24
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5259 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Doc fixes (closes #6325)David Heinemeier Hansson2006-10-091-1/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5254 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Association collections have an _ids reader method to match the existing ↵Jeremy Kemper2006-10-011-1/+6
| | | | | | writer for collection_select convenience (e.g. employee.task_ids). The writer method skips blank ids so you can safely do @employee.task_ids = params[:tasks] without checking every time for an empty list or blank values. References #1887, Closes #5780. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5214 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecation tests. Remove warnings for dynamic finders and for the foo_count ↵Jeremy Kemper2006-09-151-3/+7
| | | | | | ethod if it's also an attribute. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5116 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* We cant make MySQL 5 happy if it means making SQLite and PostgreSQL cry. So ↵David Heinemeier Hansson2006-09-081-1/+1
| | | | | | currently MySQL 5 is not fully supported for Rails when youre using eager loading (closes #6133, #6135). I have contacted MySQL to make them fix http://bugs.mysql.com/bug.php?id=13551 [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added parentheses around FROM clauses generated by Base and associations ↵David Heinemeier Hansson2006-09-081-1/+1
| | | | | | since MySQL 5 claim that to be the standard (and will screw up joins if its not there), see http://bugs.mysql.com/bug.php?id=13551 [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Backed out of new_record? to new? transformation as it would screw up ↵David Heinemeier Hansson2006-09-051-16/+22
| | | | | | existing models that did boolean calls on "new" attributes [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecated ActiveRecord::Base.new_record? in favor of ↵David Heinemeier Hansson2006-09-051-22/+16
| | | | | | ActiveRecord::Base.new? (old version still works until Rails 2.0) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Rename quote to quote_value so the name can be used in AR models. #3628 [Koz]Michael Koziarski2006-09-041-5/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5007 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add deprecation warning for inferred foreign key. #6029 [Josh Susser]Rick Olson2006-09-041-0/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecation: use :dependent => :delete_all rather than ↵Jeremy Kemper2006-09-041-1/+1
| | | | | | :exclusively_dependent => true. Closes #6024. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4981 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecation: update docs. Closes #5998.Jeremy Kemper2006-09-011-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4898 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one supports the :dependent => :delete option which skips the typical ↵Jeremy Kemper2006-08-291-3/+6
| | | | | | callback chain and deletes the associated object directly from the database. Closes #5927. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add records to has_many :through using <<, push, and concat by creating the ↵Jeremy Kemper2006-08-181-0/+6
| | | | | | association record. Raise if base or associate are new records since both ids are required to create the association. #build raises since you can't associate an unsaved record. #create! takes an attributes hash and creates the associated record and its association in a transaction. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4786 5ecf4fe2-1ee6-0310-87b1-e25e094e27de