aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_one_associations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix #5069 - Protect foreign key from mass assignment throught association ↵Jean Boussier2012-03-051-0/+16
| | | | builder
* Fix typoRafael Mendonça França2012-02-011-2/+2
|
* Use human attribute name to show the dependent destroy messageRafael Mendonça França2012-02-011-1/+25
|
* fix has_one, has_many restrict error messageManoj2012-02-011-1/+1
|
* Remove deprecation warnings from testsRafael Mendonça França2012-01-311-6/+12
|
* suggested fixes for :dependent => :restrict deprecation.Manoj2012-01-311-16/+5
|
* has_many/has_one, :dependent => :restrict, deprecation added.Manoj2012-01-291-2/+46
|
* Only call set_owner_attributes for has_one association if target exists.Dieter Komendera2011-07-041-0/+11
|
* Assign the association attributes to the associated record before the ↵Jon Leighton2011-06-301-0/+7
| | | | before_initialize callback of the record runs. Fixes #1842.
* 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-9/+0
|
* Add block setting of attributes to singular associationsAndrew White2011-05-171-0/+21
|
* Pass the attribute and option hashes to build_associationAndrew White2011-05-171-0/+16
| | | | | | | The build_association method was added as an API for plugins to hook into in 1398db0. This commit restores this API and the ability to override class.new to return a subclass based on a virtual attribute in the attributes hash.
* Don't use mass-assignment protection when setting foreign keys or ↵Jon Leighton2011-05-121-0/+33
| | | | association conditions on singular associations. Fixes #481 (again).
* Don't remove the target if it has already been destroyedAndrew White2011-05-111-0/+9
|
* Bring back obj.association_loaded? as a deprecated method. Fixes #472.Jon Leighton2011-05-111-0/+9
|
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-121-7/+7
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-7/+2
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-0/+8
| | | | ... } rather than instance_eval-ing strings
* We shouldn't be using scoped.scoping { ... } to build associated records, as ↵Jon Leighton2011-01-301-0/+15
| | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved]
* Support for create_association! for has_one associationsJon Leighton2011-01-111-0/+18
|
* When assigning a has_one, if anything fails, the assignment should be rolled ↵Jon Leighton2011-01-111-2/+5
| | | | back entirely
* When assigning a has_one, if the new record fails to save, raise an errorJon Leighton2011-01-111-14/+14
|
* When assigning a has_one, if the existing record fails to be removed from ↵Jon Leighton2011-01-111-0/+12
| | | | the association, raise an error
* has_one should always remove the old record (properly), even if not saving ↵Jon Leighton2011-01-111-10/+25
| | | | the new record, so we don't get the database into a pickle
* Construct an actual ActiveRecord::Relation object for the association scope, ↵Jon Leighton2011-01-071-8/+0
| | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things.
* Remove undocumented feature from has_one where you could pass false as the ↵Jon Leighton2011-01-031-29/+0
| | | | | | | | | | | | second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things: * Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted * Use has_many if you actually want multiple associated objects * Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g. previous = obj.assoc obj.create_assoc previous.update_attributes(:obj_id => obj.id)
* removing unused variablesAaron Patterson2010-11-221-4/+3
|
* use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-2/+2
| | | | | | | | | | | - 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>
* Set attributes properly for model built from association with conditions ↵Marcelo Giorgi2010-09-281-0/+5
| | | | | | [#5562 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-1/+1
| | | | better default failure messages - let's use them
* Use better assertion methods for testingNeeraj Singh2010-05-191-4/+4
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add :dependent = to has_one and has_many [#3075 state:resolved]Rizwan Reza2010-03-281-1/+9
|
* removing dead code from activerecord tests. [#4187 state:resolved]Aaron Patterson2010-03-151-9/+0
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Fix associations to call :destroy or :delete based on the right :dependent ↵Carlos Antonio da Silva2010-03-091-2/+2
| | | | | | option Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove the test which was testing a non-existing method, always failing on ↵Pratik Naik2010-01-021-6/+0
| | | | 1.9 and never even running on 1.8
* Make has_one with :conditions hash scope build or creation of the associated ↵Luciano G Panaro2009-09-281-0/+18
| | | | | | | object with those conditions Signed-off-by: Michael Koziarski <michael@koziarski.com> [#3088 state:committed]
* Fix has_one with foreign_key and primary_key association bug which caused ↵Graeme Porteous2009-09-121-0/+9
| | | | | | | | the associated object being lost when saving the owner. [#1756 state:resolved] Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Deprecate Error#on(attribute) in favour of Errors#[attribute]Pratik Naik2009-03-201-2/+2
|
* Fixed autosave checks on objects with hm:t in :include [#2213 state:resolved]Will Bryant2009-03-121-0/+16
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-5/+5
| | | | [#1617 state:resolved]
* Ensure replacing has_one associations respects the supplied :dependent ↵Dimitri Krassovski2009-03-061-0/+18
| | | | | | option. [#1305 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fixed that autosave should validate associations even if master is invalid ↵David Heinemeier Hansson2009-02-271-87/+0
| | | | [#1930 status:committed]
* Ensure methods called on association proxies respect access control. [#1083 ↵Pratik Naik2008-10-131-0/+10
| | | | state:resolved] [Adam Milligan, Pratik]
* Fix that has_one natural assignment to already associated record. [#854 ↵Jakub Kuźma2008-08-211-0/+10
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix file permissionsTarmo Tänav2008-07-311-0/+0
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add support for :primary_key option to has_one as well as has_many so that a ↵Brad Greenlee2008-07-061-0/+7
| | | | | | key other than the default primary key can be used for the association Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Add :validate option to associations. [#301 state:resolved]Jan De Poorter2008-06-111-0/+12
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix faulty tests introduced in 8d0b4fa39Michael Koziarski2008-05-241-1/+1
|