aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
Commit message (Collapse)AuthorAgeFilesLines
* No conditions relevant hereDavid Heinemeier Hansson2005-04-111-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1145 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* More eager fixesDavid Heinemeier Hansson2005-04-031-3/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Made eager loading work even moreDavid Heinemeier Hansson2005-04-032-14/+10
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1083 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added new Base.find API and deprecated find_all, find_first. Added ↵David Heinemeier Hansson2005-04-031-0/+5
| | | | | | preliminary support for eager loading of associations git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1077 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added that model.items.delete(child) will delete the child, not just set the ↵David Heinemeier Hansson2005-04-021-5/+9
| | | | | | foreign key to nil, if the child is dependent on the model #978 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Dont load the target before the proxy has had a chance to answer the ↵David Heinemeier Hansson2005-03-291-2/+1
| | | | | | respond_to? -- this would cause an .empty? query to trigger loading the entire collection if the proxy had already been initialized git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1036 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added destruction of dependent objects in has_one associations when a new ↵David Heinemeier Hansson2005-03-062-2/+11
| | | | | | assignment happens #742 [mindel] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that HasManyAssociation#count was using :finder_sql rather than ↵David Heinemeier Hansson2005-03-061-1/+3
| | | | | | :counter_sql if it was available #445 [Scott Barron] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@834 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that association#count would produce invalid sql when called ↵David Heinemeier Hansson2005-02-281-3/+3
| | | | | | sequentialy #659 [kanis@comcard.de] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@813 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Optimized the SQL used to generate has_and_belongs_to_many queries by ↵David Heinemeier Hansson2005-02-221-1/+1
| | | | | | listing the join table first #693 [yerejm] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@741 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed documentation snafus #575, #576, #577, #585David Heinemeier Hansson2005-02-071-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@525 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the option of supplying an array of ids and attributes to Base#update, ↵David Heinemeier Hansson2005-01-252-8/+16
| | | | | | so that multiple records can be updated at once (inspired by #526/Duane Johnson). Added the option of supplying an array of attributes to Base#create, so that multiple records can be created at once. Added that Base#delete and Base#destroy both can take an array of ids to delete/destroy #336. Added that has_many association build and create methods can take arrays of record data like Base#create and Base#build to build/create multiple records at once. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added that has_and_belongs_to_many associations with additional attributes ↵David Heinemeier Hansson2005-01-241-13/+24
| | | | | | also can be created between unsaved objects and only committed to the database when Base#save is called on the associator #524 [Eric Anderson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@484 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that find_all would produce invalid sql when called sequentialy #490 ↵David Heinemeier Hansson2005-01-201-1/+1
| | | | | | [Scott Baron] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@464 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the belongs_to and has_one proxy would fail a test like 'if ↵David Heinemeier Hansson2005-01-184-23/+8
| | | | | | project.manager' -- this unfortunately also means that you can't call methods like project.manager.build unless there already is a manager on the project #492 [Tim Bates] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@456 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Only remember that an association was loaded if it was foundDavid Heinemeier Hansson2005-01-171-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@435 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* belongs_to association should always honor a present foreign key and ↵David Heinemeier Hansson2005-01-173-23/+33
| | | | | | condition interpolation should also be possible on belongs_to git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@433 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added support for associating unsaved objects #402 [Tim Bates]David Heinemeier Hansson2005-01-156-101/+272
| | | | | | | | | Added replace to associations, so you can do project.manager.replace(new_manager) or project.milestones.replace(new_milestones) #402 [Tim Bates] Added build and create methods to has_one and belongs_to associations, so you can now do project.manager.build(attributes) #402 [Tim Bates] Fixed that Base#== wouldn't work for multiple references to the same unsaved object #402 [Tim Bates] Added that if a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. #402 [Tim Bates] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove length alias of sizeDavid Heinemeier Hansson2005-01-111-2/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@396 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added a differenciation between AssociationCollection#size and -length. Now ↵David Heinemeier Hansson2005-01-111-1/+10
| | | | | | AssociationCollection#size returns the size of the collection by executing a SELECT COUNT(*) query if the collection hasn't been loaded and calling collection.size if it has. If it's more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards, it'll take one less SELECT query if you use length. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@392 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that conditions in has_many and has_and_belongs_to_many should be ↵David Heinemeier Hansson2005-01-072-2/+2
| | | | | | interpolated just like the finder_sql is git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@344 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the overwritten respond_to? method didn't take two parameters ↵David Heinemeier Hansson2005-01-031-2/+2
| | | | | | like the original #391 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed the last details to please DB2David Heinemeier Hansson2005-01-031-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@324 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added HasManyAssociation#count that works like Base#count #413 [intinig]David Heinemeier Hansson2005-01-021-0/+11
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@318 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added that Base#find takes an optional options hash, including :conditions. ↵David Heinemeier Hansson2005-01-013-56/+93
| | | | | | Base#find_on_conditions deprecated in favor of #find with :conditions #407 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@305 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that options[:counter_sql] was overwritten with interpolated sql ↵David Heinemeier Hansson2004-12-221-1/+2
| | | | | | rather than original sql #355 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@248 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that Base.table_name would expect a parameter when used in ↵David Heinemeier Hansson2004-12-221-1/+1
| | | | | | has_and_belongs_to_many joins [Anna Lissa Cruz] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added automatic transaction block around AssociationCollection.<<, ↵David Heinemeier Hansson2004-12-151-8/+17
| | | | | | AssociationCollection.delete, and AssociationCollection.destroy_all git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@171 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_and_belongs_to_many would generate bad sql when naming ↵David Heinemeier Hansson2004-12-141-4/+4
| | | | | | conventions differed from using vanilla "id" everywhere [RedTerror] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@152 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed value quoting in all generated SQL statements, so that integers are ↵David Heinemeier Hansson2004-12-073-14/+18
| | | | | | not surrounded in quotes and that all sanitation are happening through the database's own quoting routine. This should hopefully make it lots easier for new adapters that doesn't accept '1' for integer columns. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@70 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed has_and_belongs_to_many guessing of foreign key so that keys are ↵David Heinemeier Hansson2004-12-071-1/+1
| | | | | | generated correctly for models like SomeVerySpecialClient [Florian Weber] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@69 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added counter_sql option for has_many associations [bitsweat]David Heinemeier Hansson2004-12-071-6/+12
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@68 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Silence errors occurring when reloading classesDavid Heinemeier Hansson2004-11-301-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@27 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* InitialDavid Heinemeier Hansson2004-11-243-0/+338
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de