aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Clarify semantics of ActiveRecord::Base#respond_to? Closes #2560.Jeremy Kemper2005-10-221-0/+16
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2705 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix Associations#clear for not-yet-loaded associations (Patrick Lenz)Tobias Lütke2005-10-201-0/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2695 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed a few sqlserver test case errors. Closes #2486Tobias Lütke2005-10-171-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2666 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3616@asus: jeremy | 2005-09-26 23:09:28 -0700Jeremy Kemper2005-10-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | Ticket 2292 - Sequences, schemas, and fixtures r3917@asus: jeremy | 2005-10-15 10:43:24 -0700 fix pk assert r3918@asus: jeremy | 2005-10-15 10:46:52 -0700 rework query cache connection= override r3919@asus: jeremy | 2005-10-15 10:47:45 -0700 correct fixtures usage r3920@asus: jeremy | 2005-10-15 10:53:23 -0700 correct attr assignment r3921@asus: jeremy | 2005-10-15 12:59:10 -0700 sequences r3922@asus: jeremy | 2005-10-15 16:36:09 -0700 reset fixtures work with sequences r3951@asus: jeremy | 2005-10-15 23:23:12 -0700 cut down excess features r3952@asus: jeremy | 2005-10-15 23:40:30 -0700 don't test for PostgreSQL specifically git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2639 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Adds :nullify option to :depends. Closes #2015 (Robby Russell)Tobias Lütke2005-10-151-6/+25
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2595 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* DRYed up Associations#clear. Closes #1906 [Caleb]Tobias Lütke2005-10-141-1/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2580 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix errors caused by assigning a has-one or belongs-to property to itselfJamis Buck2005-10-131-0/+10
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2562 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Association validation does not belong in a before_save callback: move it ↵Jeremy Kemper2005-10-021-1/+2
| | | | | | into a validation method. Restores the expected model.valid? == model.save. Add tests for cancelling save by returning false from a before_save callback. Remove assumption that before_destroy's return value indicates whether the record was destroyed. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2434 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3657@asus: jeremy | 2005-09-28 00:32:33 -0700Jeremy Kemper2005-09-281-1/+3
| | | | | | | Also test that client.firm_id.nil? after firm.clients.clear when clients is not :dependent git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3653@asus: jeremy | 2005-09-28 00:23:49 -0700Jeremy Kemper2005-09-281-12/+53
| | | | | | | Ticket 2221 - model.association.clear should destroy associated objects if :dependent => true instead of nullifying their foreign keys git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the create_x method from belongs_to wouldn't save the association ↵David Heinemeier Hansson2005-09-201-0/+3
| | | | | | properly #2042 [Florian Weber] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2279 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed saving a record with two unsaved belongs_to associations pointing to ↵Jamis Buck2005-09-201-0/+45
| | | | | | the same object #2023 [Tobias Luetke] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2278 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed various problems with has_and_belongs_to_many when using customer ↵David Heinemeier Hansson2005-09-131-0/+13
| | | | | | finder_sql #2094 [Florian Weber] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the SQL Server adapter would sometimes return DBI::Timestamp ↵David Heinemeier Hansson2005-09-091-4/+4
| | | | | | objects instead of Time #2127 [Tom Ward] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2169 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactored away all the legacy validate_options calls and replaced them with ↵David Heinemeier Hansson2005-09-091-1/+1
| | | | | | Hash#assert_valid_keys git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert [2040], caused assignment of belongs_to associations to fail in some ↵Jamis Buck2005-08-241-6/+17
| | | | | | cases git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2048 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add a failing testJamis Buck2005-08-241-0/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2047 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Saving a record with two unsaved belongs_to associations pointing to the ↵Jamis Buck2005-08-231-0/+41
| | | | | | same object fails #2023 [Tobias Luetke] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2040 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow unspecified join-table columns to use to their default values when ↵Jamis Buck2005-07-181-0/+20
| | | | | | adding to a habtm collection git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1860 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_and_belongs_to_many didn't respect single table inheritance ↵David Heinemeier Hansson2005-07-031-0/+14
| | | | | | types #1081 [Florian Weber] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1641 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added support for ODBC connections to MS SQL Server so you can connect from ↵David Heinemeier Hansson2005-07-011-4/+24
| | | | | | a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry] Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1583 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Updated all references to the old find_first and find_all to use the new ↵David Heinemeier Hansson2005-06-261-24/+24
| | | | | | style #1511 [Marcel Molina] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1520 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Pass association finder arguments through to the association class exactly ↵Jeremy Kemper2005-06-241-1/+1
| | | | | | as we received them. Fixes case where parent.children.find() is interpreted as Child.find([]) instead of Child.find(). git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1498 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removed the AR::Recursion module--it broke more code than it fixedJamis Buck2005-06-211-0/+38
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1470 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that adding a record to a has_and_belongs_to collection would always ↵David Heinemeier Hansson2005-06-181-0/+16
| | | | | | save it -- now it only saves if its a new record #1203 [Alisdair McDiarmid] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1453 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added actual database-changing behavior to collection assigment for has_many ↵David Heinemeier Hansson2005-06-161-0/+59
| | | | | | and has_and_belongs_to_many #1425 [Sebastian Kanthak] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1428 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r1307@iwill: jeremy | 2005-06-13 19:05:00 -0700Jeremy Kemper2005-06-131-4/+7
| | | | | | | | | | | | | | | Ticket 1312 - Malformed habtm finder sql r1308@iwill: jeremy | 2005-06-13 19:58:48 -0700 Add a habtm with an unquoted condition to Project. r1309@iwill: jeremy | 2005-06-13 19:59:46 -0700 Space out habtm finder conditions. r1310@iwill: jeremy | 2005-06-13 20:00:16 -0700 Test habtm.find with quoted and unquoted conditions. r1311@iwill: jeremy | 2005-06-13 20:00:25 -0700 Update changelog git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1414 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Be sure to use the @finder_sql in the has_many association's #find method, ↵Jamis Buck2005-06-131-6/+12
| | | | | | even if explicit conditions have not been given. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1412 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r1294@iwill: jeremy | 2005-06-13 02:17:42 -0700Jeremy Kemper2005-06-131-2/+11
| | | | | | | | | | | Ticket #1281 r1295@iwill: jeremy | 2005-06-13 02:50:50 -0700 Apply patch, tweak, and test. r1296@iwill: jeremy | 2005-06-13 02:51:04 -0700 Changelog entry. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1410 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't expect fixtures to be returned in the order they were inserted.Jeremy Kemper2005-06-121-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1403 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Do not use instantiated fixtures (in general) in tests. Also, support the ↵Jamis Buck2005-06-101-2/+3
| | | | | | use of transactional fixtures by setting the AR_TX_FIXTURES environment variable to "yes". git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1399 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Eager loading of dependent has_one associations won't delete the association ↵Jamis Buck2005-06-101-105/+93
| | | | | | #1212. Also, starting to refactor the tests to make them speedier, with optional support for transactional fixtures. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1398 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added a second parameter to the build and create method for has_one that ↵David Heinemeier Hansson2005-06-061-0/+29
| | | | | | controls whether the existing association should be replaced (which means nullifying its foreign key as well). By default this is true, but false can be passed to prevent it. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1392 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that :delete_sql in has_and_belongs_to_many associations couldn't ↵David Heinemeier Hansson2005-05-191-0/+19
| | | | | | access record properties #1299 [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Updated documentation here and thereDavid Heinemeier Hansson2005-04-181-10/+13
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1210 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Moved build_association and create_association for has_one and belongs_to ↵David Heinemeier Hansson2005-04-121-0/+37
| | | | | | out of deprecation as they work when the association is nil unlike association.build and association.create, which require the association to be already in place #864 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1146 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed counter_sql when no records exist in database for PostgreSQL (would ↵David Heinemeier Hansson2005-04-071-0/+4
| | | | | | give error, not 0) #1039 [Caleb Tennis] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1104 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Made eager loading work even moreDavid Heinemeier Hansson2005-04-031-26/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1083 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow order, conditions, and joins in finds that include associationsDavid Heinemeier Hansson2005-04-031-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1080 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added new Base.find API and deprecated find_all, find_first. Added ↵David Heinemeier Hansson2005-04-031-1/+23
| | | | | | 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-4/+16
| | | | | | 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
* Added destruction of dependent objects in has_one associations when a new ↵David Heinemeier Hansson2005-03-061-1/+2
| | | | | | assignment happens #742 [mindel] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove outdated dev-utilsDavid Heinemeier Hansson2005-02-231-1/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@765 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed documentation snafus #575, #576, #577, #585David Heinemeier Hansson2005-02-071-19/+19
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@525 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Dont call id explicitly to do reloading that way we get rid of the warnings ↵David Heinemeier Hansson2005-02-071-10/+10
| | | | | | #583 [Tim Bates] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the option of supplying an array of ids and attributes to Base#update, ↵David Heinemeier Hansson2005-01-251-0/+13
| | | | | | 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-0/+21
| | | | | | 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 association proxies would fail === tests like PremiumSubscription ↵David Heinemeier Hansson2005-01-231-0/+4
| | | | | | === @account.subscription git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@476 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the belongs_to and has_one proxy would fail a test like 'if ↵David Heinemeier Hansson2005-01-181-5/+22
| | | | | | 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
* Added test_forgetting_the_load_when_foreign_key_enters_lateDavid Heinemeier Hansson2005-01-171-0/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@436 5ecf4fe2-1ee6-0310-87b1-e25e094e27de