Mikhail Dieterle
8159bc9cf5
allow to pass Symbol or Proc into :limit option of #accepts_nested_attributes_for
2012-08-26 03:02:05 +03:00
Jon Leighton
e1cfa6e070
Convert association macros to the new syntax
2012-07-20 14:14:51 +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
Jon Leighton
c6e10b0f60
has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle
2011-01-11 13:45:06 -08:00
David Chelimsky
1f06652a57
use persisted? instead of new_record? wherever possible
...
- 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>
2010-11-09 13:54:04 -02:00
James Le Cuirot
f664c57fe8
Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. Reapplied from before but now allows already-saved records to be refreshed.
...
[#4830 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:32:06 +02:00
José Valim
85cc1fa657
Revert "Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [ #4642 state:open]"
...
This commit introduced a regression described in ticket [#4830 ].
This reverts commit 0265c708b9
.
2010-06-11 17:05:54 +02:00
James Le Cuirot
0265c708b9
Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [ #4642 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-06-09 18:17:52 +05:30
Eloy Duran
f2aacd5140
Rollback the transaction when one of the autosave associations fails to save. [ #3391 state:resolved]
2010-01-08 21:45:02 +01:00
Eloy Duran
c23fbd0d47
Refactored previous changes to nested attributes.
2009-12-28 21:09:22 +01:00
Eloy Duran
f125a34501
Define autosave association callbacks when using accepts_nested_attributes_for.
...
This way we don't define all the validation methods for all associations by
default, but only when needed.
[#3355 state:resolved]
2009-11-07 00:42:42 +01:00
Pratik Naik
572323135f
Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method
...
Conflicts:
activerecord/lib/active_record/nested_attributes.rb
2009-10-07 23:50:30 +01:00
Alexey Kovyrin
938c0ee045
Define autosave association validation methods only when needed. [ #3161 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 16:04:36 +02:00
Mike Breen
9010ed2755
Allow you to pass :all_blank to :reject_if option to automatically create a Proc that will reject any record with blank attributes.
2009-05-10 15:02:00 +12:00
Luca Guidi
47bdf3bf40
Ensure AutosaveAssociation runs remove callbacks [ #2146 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-12 15:24:37 +00:00
Lance Ivy
5dbc9d40a4
Changed API of NestedAttributes to take an array, or hash with index keys, of hashes that have the id on the inside of the attributes hash and updated the FormBuilder to produce such hashes. Also fixed NestedAttributes with composite ids.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
[#1892 state:committed]
2009-02-13 21:47:56 +13:00
Eloy Duran
ec8f045844
Add support for nested object forms to ActiveRecord and the helpers in ActionPack
...
Signed-Off-By: Michael Koziarski <michael@koziarski.com>
[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Xavier Noria
593e21d6ae
Dirty attributes aren't cleared if save fails. [ #174 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-05-12 17:04:17 -07:00
Jeremy Kemper
b1ea27630d
Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 03:27:31 +00:00
Jeremy Kemper
43b81d01d0
move assets and models
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:27:03 +00:00