aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/autosave_association_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use Ruby 1.8 syntaxRafael Mendonça França2013-07-151-1/+1
|
* Merge pull request #11451 from ↵Yves Senn2013-07-151-0/+7
| | | | | | | | | | | jetthoughts/11450_do_not_resave_destroyed_association Do not re-save destroyed association on saving parent object Conflicts: activerecord/lib/active_record/autosave_association.rb Conflicts: activerecord/CHANGELOG.md
* build fix, fall back to old hash syntaxYves Senn2013-06-261-3/+3
|
* Merge pull request #9893 from ↵Yves Senn2013-06-251-0/+13
|\ | | | | | | | | JonRowe/add_test_to_assert_association_doesnt_overwrite Add a test to assert autosaving associations doesn't overwrite id accessor methods
| * test case to assert that associations do not overwrite after create, fixes #9310Jon Rowe2013-03-241-0/+13
| |
* | Using 1.8.7 syntax for 3-2-stableArun Agrawal2013-05-241-4/+4
| |
* | destroys association records before saving/inserting new association recordsJohnny Holton2013-05-181-3/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | This is a backport of #10417 fixes bug introduced by #3329 These are the conditions necessary to reproduce the bug: - For an association, autosave => true. - An association record is being destroyed - A new association record is being created. - There is a unique index one of the association's fields. - The record being created has the same value as the record being destroyed on the indexed field. Before, the deletion of records was postponed until after all insertions/saves. Therefore the new record with the identical value in the indexed field caused a non-unique value error to be thrown at the database level. With this fix, the deletions happen first, before the insertions/saves. Therefore the record with the duplicate value is gone from the database before the new record is created, thereby avoiding the non-uniuqe value error.
* Backport #3329 to 3-2-stableFrancesco Rodriguez2012-07-021-0/+10
| | | | | | | Fix bug with autosave collection association on new record with a marked for destroy record in autosave collection. Fixes #6918.
* Fix build. It seems that the Mocha's behavior were changed.kennyj2012-04-241-2/+6
|
* Test case and fix for rails/rails#3450Jan Varwig2011-11-271-0/+11
| | | | Asssigning a parent id to a belongs_to association actually updates the object that is validated when the association has :validates => true
* Oops, this should have been in the last commit :zap:Jon Leighton2011-06-121-1/+1
|
* 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.
* expectations change when using IM. Change oracle tests to reflect thatAaron Patterson2011-02-221-2/+6
|
* Use proper objects to do the work to build the associations (adding methods, ↵Jon Leighton2011-02-211-4/+4
| | | | callbacks etc) rather than calling a whole bunch of methods with rather long names.
* Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-02-211-1/+1
|\
| * Tpyo: fixing several cases of the theNicholas Rowe2011-02-191-1/+1
| |
* | fixes a merge conflictXavier Noria2011-02-191-10/+0
|/
* merges docrailsXavier Noria2011-02-181-0/+10
|\
| * Fix Typos: remove several occurences of the theNicholas Rowe2011-02-171-1/+1
| |
* | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-181-1/+1
|\ \ | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association.rb activerecord/lib/active_record/fixtures.rb
| * | Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-1/+1
| | | | | | | | | | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* | | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-85/+189
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb
| * | Refactor the implementations of AssociatioCollection#delete and #destroy to ↵Jon Leighton2011-02-071-1/+1
| | | | | | | | | | | | be more consistent with each other, and to stop passing blocks around, thus making the execution easier to follow.
| * | Make record.association.destroy(*records) on habtm and hm:t only delete ↵Jon Leighton2011-02-071-72/+169
| |/ | | | | | | records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry.
| * In a number of places in the tests, we only need to turn off transactional ↵Jon Leighton2011-01-111-10/+10
| | | | | | | | fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :)
| * When assigning a has_one, if the new record fails to save, raise an errorJon Leighton2011-01-111-2/+2
| |
| * Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-0/+7
| | | | | | | | | | | | | | | | | | | | state:resolved] This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message!
* | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2010-12-201-4/+15
|\| | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/persistence.rb
| * Only call save on belongs_to associations if the record has changed or any ↵Chiel Wester2010-12-161-0/+11
| | | | | | | | | | | | nested associations have changed (resolves #3353) Signed-off-by: José Valim <jose.valim@gmail.com>
| * converting clone test to dup testAaron Patterson2010-11-231-4/+4
| |
* | Call super setup in this test.Emilio Tagua2010-11-191-1/+2
| |
* | Revert "IdentityMap - Adjustments to test cases"Emilio Tagua2010-11-191-6/+1
| | | | | | | | | | | | | | | | This reverts commit 4db9dca55e3acc2c59f252eb83ecb83db5f4b81b. Conflicts: activerecord/test/cases/identity_map_test.rb
* | IdentityMap - Adjustments to test casesMarcin Raczkowski2010-11-191-1/+6
|/
* removing many unused variablesAaron Patterson2010-11-161-4/+2
|
* use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-43/+43
| | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* has_one maintains the association with separate after_create/after_updateXavier Noria2010-10-221-0/+20
| | | | | This way parent models can get their own after_create and after_update callbacks fired after has_one has done its job.
* get rid of the warning "+ after local variable is interpreted as binary ↵Xavier Noria2010-08-191-13/+13
| | | | operator even though it seems like unary operator" in Ruby 1.9.2
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* missing requires addedSantiago Pastorino2010-07-261-0/+2
|
* Removing unnecessary code [#5192 state:resolved]Thiago Pradi2010-07-261-1/+7
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "save on parent should not cascade to child unless child changed ↵José Valim2010-07-211-18/+0
| | | | | | | | [#3353 state:open]" Please check Lighthouse for more information. This reverts commit 4a0d7c1a439c6ad8d35bf514761824e51fa07df2.
* save on parent should not cascade to child unless child changed [#3353 ↵Subba Rao Pasupuleti2010-07-181-0/+18
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix bug with rolling back frozen attributes.Brian Durand2010-06-181-1/+0
| | | | | | [#2991] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fixing test class names and refactor line in autosave associationCarlos Antonio da Silva2010-06-071-4/+4
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Use better assertion methods for testingNeeraj Singh2010-05-191-4/+4
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Make use of assert_equal to test equallity between object assert expects and ↵Santiago Pastorino2010-05-161-2/+2
| | | | | | | | object and a message of error [#4611 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Drop AR I18n deprecation and simple use errors.messages as fallback.José Valim2010-01-301-2/+2
|
* save(false) is gone, use save(:validate => false) instead.José Valim2010-01-171-6/+6
|
* Different nested validations should not be ignore [#3638 status:resolved]José Valim2010-01-141-0/+8
|