aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* has_many :through conditions are sanitized by the associating class. Closes ↵Jeremy Kemper2006-09-011-0/+6
| | | | | | #5971. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one supports the :dependent => :delete option which skips the typical ↵Jeremy Kemper2006-08-291-0/+18
| | | | | | 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
* Cache nil results for :included has_one associations also. Closes #5787.Jeremy Kemper2006-08-171-0/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4783 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed a bug which would cause .save to fail after trying to access a empty ↵Tobias Lütke2006-08-161-0/+10
| | | | | | has_one association on a unsaved record. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4773 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Cache nil results for has_one associations so multiple calls don't call the ↵Rick Olson2006-08-081-0/+5
| | | | | | database. Closes #5757. [Michael A. Schoen] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4721 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't save has_one associations unnecessarily. Closes #5735.Jeremy Kemper2006-08-061-0/+17
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4690 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Oracle: use nonblocking queries if allow_concurrency is set, fix pessimistic ↵Jeremy Kemper2006-07-071-1/+7
| | | | | | locking, don't guess date vs. time by default (set OracleAdapter.emulate_dates = true for the old behavior), adapter cleanup. Closes #5635. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4574 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Doc fix (closes #5504) [lee@omara.ca]David Heinemeier Hansson2006-07-051-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4543 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_many.create ended up with duplicate objects (closes #5250) ↵David Heinemeier Hansson2006-06-031-0/+8
| | | | | | [daniel@nouvelles-solutions.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4416 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* band-aid for oracleRick Olson2006-05-291-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4380 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix the has_and_belongs_to_many #create doesn't populate the join for new ↵Rick Olson2006-05-291-0/+28
| | | | | | records. Closes #3692 [josh@hasmanythrough.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4379 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Provide Association Extensions access to the instance that the association ↵Rick Olson2006-05-281-0/+23
| | | | | | is being accessed from. Closes #4433 [josh@hasmanythrough.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4372 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make Oracle happyDavid Heinemeier Hansson2006-05-211-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4357 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_many collections shouldn't load the entire association to do ↵David Heinemeier Hansson2006-05-211-0/+29
| | | | | | build or create [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4354 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* uniq preserves order. References [4325].Jeremy Kemper2006-05-071-6/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4326 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix the HasManyAssociation#count method so it uses the new ↵Rick Olson2006-04-191-2/+18
| | | | | | ActiveRecord::Base#count syntax, while maintaining backwards compatibility. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that AssociationCollection#delete_all should work even if the records ↵Florian Weber2006-04-031-0/+19
| | | | | | of the association are not loaded yet. [Florian Weber] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4144 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that records returned from has_and_belongs_to_many associations with ↵David Heinemeier Hansson2006-04-011-1/+21
| | | | | | additional attributes should be marked as read only (fixes #4512) [DHH] DEPRECATED: Using additional attributes on has_and_belongs_to_many associations. Instead upgrade your association to be a real join model [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4123 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Rework table aliasing to account for truncated table aliases. Add smarter ↵Rick Olson2006-03-181-1/+1
| | | | | | table aliasing when doing eager loading of STI associations. This allows you to use the association name in the order/where clause. [Jonathan Viney / Rick Olson] closes #4108 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3921 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Alias the has_and_belongs_to_many join table on eager includes. closes #4106 ↵Rick Olson2006-03-161-0/+4
| | | | | | [jeremyevans0@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3895 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix test_find_in_association_with_options test, tweak other tests affected ↵Rick Olson2006-03-161-14/+14
| | | | | | by developer/project addition git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* a few more tests for the custom counter_cache naming codeJamis Buck2006-03-091-17/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3826 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow counter_cache to accept a column nameJamis Buck2006-03-091-1/+21
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3825 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make counter cache work when replacing an association (closes #3245). Thanks ↵Jamis Buck2006-03-041-0/+32
| | | | | | for the patch! git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that calling HasOneProxy#build_model repeatedly would cause saving to ↵David Heinemeier Hansson2006-03-031-0/+9
| | | | | | happen (closes #4058) [anna@wota.jp] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3753 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added assert_date_from_db to do cleaner tests for SQL Server (closes #3557) ↵David Heinemeier Hansson2006-01-211-21/+5
| | | | | | [Tom Ward] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3452 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix date errors for SQLServer in association tests. Closes #3406.Marcel Molina2006-01-131-8/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3404 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that saving a model with multiple habtm associations, would only save ↵Florian Weber2005-12-211-0/+16
| | | | | | the first habtm association. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3331 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added option inheritance for find calls on has_and_belongs_to_many and ↵David Heinemeier Hansson2005-12-131-1/+11
| | | | | | | | has_many assosociations [DHH] Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [DHH] Added form_remote_for (form_for meets form_remote_tag) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3287 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix some test failures due to MySQL assumptions. Closes #3149.Jeremy Kemper2005-12-081-2/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3254 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Made test_update_attributes_after_push_without_duplicate_join_table_rows ↵Florian Weber2005-11-241-2/+2
| | | | | | pass with Oracle Adapter. #2888 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed bug where using update_attribute after pushing a record to a habtm ↵Florian Weber2005-11-231-1/+10
| | | | | | association of the object caused duplicate rows in the join table. #2888 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3095@asus: jeremy | 2005-11-15 22:40:51 -0800Jeremy Kemper2005-11-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | Ticket #1874 - Firebird adapter r3107@asus: jeremy | 2005-11-16 00:06:14 -0800 quote column aliases r3108@asus: jeremy | 2005-11-16 00:08:12 -0800 quote columns in construct_conditions_from_arguments. update sequence_name docs. introduce prefetched primary keys. r3109@asus: jeremy | 2005-11-16 00:09:08 -0800 double-quote rather than single-quote sqlite columns r3110@asus: jeremy | 2005-11-16 00:09:56 -0800 quote column names and use attribute_condition in validates_uniqueness_of r3111@asus: jeremy | 2005-11-16 00:12:24 -0800 Use QUOTED_TYPE constant in tests r3112@asus: jeremy | 2005-11-16 00:13:28 -0800 restrict test_inserts_with_pre_and_suffix to those adapters which support migrations r3113@asus: jeremy | 2005-11-16 00:14:09 -0800 Use QUOTED_TYPE constant in tests r3114@asus: jeremy | 2005-11-16 00:14:30 -0800 Use QUOTED_TYPE constant in tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Associations handle case-equality more consistently: item.parts.is_a?(Array) ↵Jeremy Kemper2005-11-151-0/+16
| | | | | | and item.parts === Array. Closes #1345. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add :group option, correspond to GROUP BY, to the find method and to the ↵Jeremy Kemper2005-11-101-0/+7
| | | | | | has_many association. Closes #2818. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Destroy associated has_and_belongs_to_many records after all before_destroy ↵Jeremy Kemper2005-11-081-3/+6
| | | | | | callbacks but before destroy. This allows you to act on the habtm association as you please while preserving referential integrity. Closes #2065. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2940 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added extension capabilities to has_many and has_and_belongs_to_many proxies ↵David Heinemeier Hansson2005-11-041-0/+8
| | | | | | [DHH] Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [DHH] Added constrain scoping for creates using a hash of attributes bound to the :creation key [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2872 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Made more tests for SQLServer pass (closes #2486) [Tom Ward]David Heinemeier Hansson2005-10-281-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2779 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactor DB exceptions and deal more with DB2 (closes #2624)David Heinemeier Hansson2005-10-271-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* 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