aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add a proxy_association method to association proxies, which can be called ↵Jon Leighton2011-07-271-0/+5
| | | | by association extensions to access information about the association. This replaces proxy_owner etc with proxy_association.owner.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-251-12/+0
|
* Implement proxy_owner, proxy_target and proxy_reflection methods on ↵Jon Leighton2011-05-191-0/+12
| | | | CollectionProxy with deprecations. Fixes #1148.
* minor cleaningVishnu Atrai2011-05-101-1/+1
|
* Added new #update_column method.Sebastian Martinez2011-03-271-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Revert "Removed #update_attribute method. New #update_column method."Sebastian Martinez2011-03-271-2/+2
| | | | | | This reverts commit 45c233ef819dc7b67e259dd73f24721fec28b8c8. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Removed #update_attribute method. New #update_column method.Sebastian Martinez2011-03-261-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Remove test which was broken on 1.8. This test is now irrelevant since ↵Jon Leighton2011-02-181-8/+0
| | | | singular associations no longer return a proxy object.
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-36/+0
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* class inheritable attributes is used no more! all internal use of class ↵Josh Kalderimis2010-11-201-4/+4
| | | | | | inheritable has been changed to class_attribute. class inheritable attributes has been deprecated. Signed-off-by: José Valim <jose.valim@gmail.com>
* removing many unused variablesAaron Patterson2010-11-161-1/+1
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-3/+3
| | | | 's/[ \t]*$//' -i {} \;)
* Making Active Record base_test.rb thinner by moving testsNeeraj Singh2010-08-031-0/+22
| | | | | | | | | | | | to relevant files. Number of assertions before refactoring: 2391 tests, 7579 assertions, 0 failures, 0 errors Number of assertions after refactoring: 2391 tests, 7579 assertions, 0 failures, 0 errors Signed-off-by: José Valim <jose.valim@gmail.com>
* Eager loading an association should not change the count of childrenNeeraj Singh2010-08-021-0/+13
| | | | | | [#4971 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-11/+0
| | | | | | [#5153 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Strengthening the test for nested_attributeSubba Rao Pasupuleti2010-07-211-1/+20
| | | | | | | | Loading the associate target in nested_attributes should load most recent attributes for child records marked for destruction Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix the #using_limitable_reflections? helper to work correctly by not ↵Ken Collins2010-07-081-0/+10
| | | | | | examining the length of an array which contains false/true, hence always passing. [#4869 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* restricts a test to < 1.9, and rewrites it using a proper expectationXavier Noria2010-03-131-11/+5
| | | | Signed-off-by: wycats <wycats@gmail.com>
* adds coverage for the issue addressed in fe43bbdXavier Noria2010-03-121-0/+14
| | | | | | [#4166 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* When passing force_reload = true to an association, don't use the query ↵Will2009-12-161-0/+10
| | | | | | cache [#1827 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Removed legacy test.Emilio Tagua2009-07-201-19/+0
|
* Remove the functionality introduce in 28d3390Michael Koziarski2008-10-101-20/+0
| | | | There are several situations it doesn't cater for, and the inconsistency isn't worth blocking 2.2.
* Fixed an error triggered by a reload followed by a foreign key assignment.Nathaniel Talbott2008-09-201-0/+8
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Support for updating a belongs to association from the foreign key (without ↵Jon Leighton2008-09-131-0/+12
| | | | | | | saving and reloading the record) Signed-off-by: Michael Koziarski <michael@koziarski.com> [#142 state:committed]
* Revert "Add :accessible option to Associations for allowing mass assignments ↵Pratik Naik2008-09-101-108/+0
| | | | | | | | | | | | using hash. [#474 state:resolved]" This reverts commit e0750d6a5c7f621e4ca12205137c0b135cab444a. Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_collection.rb
* Include people and readers fixtures to fix test isolation errorJeremy Kemper2008-08-261-2/+2
|
* Fix file permissionsTarmo Tänav2008-07-311-0/+0
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add :accessible option to Associations for allowing mass assignments using ↵David Dollar2008-07-141-0/+108
| | | | | | | | | | | | | | | | | | | | | | | | | hash. [#474 state:resolved] Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate ActiveRecord models. class Post < ActiveRecord::Base belongs_to :author, :accessible => true has_many :comments, :accessible => true end post = Post.create({ :title => 'Accessible Attributes', :author => { :name => 'David Dollar' }, :comments => [ { :body => 'First Post!' }, { :body => 'Nested Hashes are great!' } ] }) post.comments << { :body => 'Another Comment' } Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Create through associations can now work with blocks.Ryan Bates2008-05-241-6/+9
| | | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#248 state:resolved]
* add failing test case for block-setting of attributes via associationTrevor Turk2008-05-241-0/+9
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Add first/last methods to associations/named_scope. [#226 state:resolved]Ryan Bates2008-05-201-2/+2
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Calling ActiveRecord#inspect on an unloaded association won't wipe the ↵Andreas Neuhaus2008-05-081-0/+6
| | | | | | collection [#9 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Use schema.rb for all databasesFrederick Cheung2008-04-221-1/+1
| | | | | | Move adapter specific schema into their own files Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Split associations_test.rb into multiple files based on association type. ↵Pratik Naik2008-04-061-2382/+0
| | | | | | [Pratik] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that save on parent object fails for invalid has_one association. ↵Pratik Naik2008-04-061-0/+12
| | | | | | Closes #10518. [Pratik] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactor HasManyThroughAssociation to inherit from HasManyAssociation. ↵Pratik Naik2008-04-061-3/+191
| | | | | | Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]Pratik Naik2008-04-051-13/+27
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add efficient #include? to AssociationCollection (for has_many/has_many ↵Rick Olson2008-04-011-0/+60
| | | | | | :through/habtm). [stopdropandrew] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Partial updates include only unsaved attributes. Off by default; set ↵Jeremy Kemper2008-03-311-1/+2
| | | | | | YourClass.partial_updates = true to enable. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that has_many :through would ignore the hash conditions (closes ↵David Heinemeier Hansson2008-03-281-0/+5
| | | | | | #11447) [miloops] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9110 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make sure ActiveRecord tests can run individually. Closes #11425 ↵Pratik Naik2008-03-281-1/+1
| | | | | | [thechrisoshow, h-lame] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix duplicate table alias error when including an association with a ↵Rick Olson2008-03-261-1/+6
| | | | | | 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
* has_one :through supports :source_type. Fix up some tests. References #4756.Jeremy Kemper2008-03-221-4/+15
| | | | 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-0/+24
| | | | | | 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-1/+62
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]Pratik Naik2008-03-071-0/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce the :readonly option to all associations. Records from the ↵Jeremy Kemper2008-02-131-0/+20
| | | | | | association cannot be saved. Closes #11084. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey ↵Jeremy Kemper2008-02-021-1/+10
| | | | | | Kondratenko] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de