Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | We shouldn't be using scoped.scoping { ... } to build associated records, as ↵ | Jon Leighton | 2011-01-30 | 1 | -0/+15 |
| | | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved] | ||||
* | Support for create_association! for has_one associations | Jon Leighton | 2011-01-11 | 1 | -0/+18 |
| | |||||
* | When assigning a has_one, if anything fails, the assignment should be rolled ↵ | Jon Leighton | 2011-01-11 | 1 | -2/+5 |
| | | | | back entirely | ||||
* | When assigning a has_one, if the new record fails to save, raise an error | Jon Leighton | 2011-01-11 | 1 | -14/+14 |
| | |||||
* | When assigning a has_one, if the existing record fails to be removed from ↵ | Jon Leighton | 2011-01-11 | 1 | -0/+12 |
| | | | | the association, raise an error | ||||
* | has_one should always remove the old record (properly), even if not saving ↵ | Jon Leighton | 2011-01-11 | 1 | -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 Leighton | 2011-01-07 | 1 | -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 Leighton | 2011-01-03 | 1 | -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 variables | Aaron Patterson | 2010-11-22 | 1 | -4/+3 |
| | |||||
* | use persisted? instead of new_record? wherever possible | David Chelimsky | 2010-11-09 | 1 | -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 Giorgi | 2010-09-28 | 1 | -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 Noria | 2010-08-17 | 1 | -1/+1 |
| | | | | better default failure messages - let's use them | ||||
* | Use better assertion methods for testing | Neeraj Singh | 2010-05-19 | 1 | -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 Reza | 2010-03-28 | 1 | -1/+9 |
| | |||||
* | removing dead code from activerecord tests. [#4187 state:resolved] | Aaron Patterson | 2010-03-15 | 1 | -9/+0 |
| | | | | Signed-off-by: wycats <wycats@gmail.com> | ||||
* | Fix associations to call :destroy or :delete based on the right :dependent ↵ | Carlos Antonio da Silva | 2010-03-09 | 1 | -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 Naik | 2010-01-02 | 1 | -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 Panaro | 2009-09-28 | 1 | -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 Porteous | 2009-09-12 | 1 | -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 Naik | 2009-03-20 | 1 | -2/+2 |
| | |||||
* | Fixed autosave checks on objects with hm:t in :include [#2213 state:resolved] | Will Bryant | 2009-03-12 | 1 | -0/+16 |
| | | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com> | ||||
* | Ruby 1.9 compat: rename deprecated assert_raises to assert_raise. | Jeremy Kemper | 2009-03-08 | 1 | -5/+5 |
| | | | | [#1617 state:resolved] | ||||
* | Ensure replacing has_one associations respects the supplied :dependent ↵ | Dimitri Krassovski | 2009-03-06 | 1 | -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 Hansson | 2009-02-27 | 1 | -87/+0 |
| | | | | [#1930 status:committed] | ||||
* | Ensure methods called on association proxies respect access control. [#1083 ↵ | Pratik Naik | 2008-10-13 | 1 | -0/+10 |
| | | | | state:resolved] [Adam Milligan, Pratik] | ||||
* | Fix that has_one natural assignment to already associated record. [#854 ↵ | Jakub Kuźma | 2008-08-21 | 1 | -0/+10 |
| | | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com> | ||||
* | Fix file permissions | Tarmo Tänav | 2008-07-31 | 1 | -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 Greenlee | 2008-07-06 | 1 | -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 Poorter | 2008-06-11 | 1 | -0/+12 |
| | | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com> | ||||
* | Fix faulty tests introduced in 8d0b4fa39 | Michael Koziarski | 2008-05-24 | 1 | -1/+1 |
| | |||||
* | Added :select option to has_one and belongs_to, remove unused :order option ↵ | josevalim | 2008-05-24 | 1 | -0/+5 |
| | | | | | | | on belongs_to. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#241 state:resolved] | ||||
* | Split associations_test.rb into multiple files based on association type. ↵ | Pratik Naik | 2008-04-06 | 1 | -0/+318 |
[Pratik] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de |