Gabriel Horner
f5e4d13270
use existing model for testing Base.create with #after_initialize
2011-07-24 16:36:06 -04:00
Jon Leighton
0e225ec583
Assign the association attributes to the associated record before the before_initialize callback of the record runs. Fixes #1842 .
2011-06-30 23:39:58 +01:00
Andrew White
42f1ad6865
Pass the attribute and option hashes to build_association
...
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.
2011-05-17 20:43:30 +01:00
Jon Leighton
60b23ea1da
CollectionAssociation#merge_target_lists should write to the underlying attributes when copying, rather than using the assignment method
2011-05-14 19:49:22 +01:00
Jon Leighton
a8c1fa4afd
Add test to specify that attributes from an association's conditions should be assigned without mass-assignment protection when a record is built on the association.
2011-05-10 23:35:15 +01:00
Jon Leighton
6f84c73dc4
Un-deprecate using 'default_scope' as a macro, but if you are calling the macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
2011-04-18 23:15:38 +01:00
Jon Leighton
5740d4ec0c
Deprecated support for passing hashes and relations to default_scope, in favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
2011-04-12 19:46:04 -07:00
Jon Leighton
63c73dd021
We shouldn't be using scoped.scoping { ... } to build associated records, as this can affect validations/callbacks/etc inside the record itself [ #6252 state:resolved]
2011-01-30 11:56:41 +00:00
Neeraj Singh
2e45542942
While creating a new record using has_many create method default scope of child should be respected.
...
author.posts.create should take into account default_scope
defined on post.
[#3939 : state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 14:52:15 -03:00