1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

32 commits

Author SHA1 Message Date
Neeraj Singh
6ba7d5e654 - without the id test is passing even if I change :allow_destroy from 'false' - adding more tests to strengthen the test suite
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-21 14:25:13 +02:00
Neeraj Singh
01629d1804 This patch changes update_attribute implementatino so:
- it will only save the attribute it has been asked to save and not all dirty attributes

- it does not invoke callbacks

- it does change updated_at/on

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 22:43:18 +02:00
James Le Cuirot
f3fedd7f84 Don't remove scheduled destroys when loading an association. [#4642 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-01 01:06:58 +02:00
George Montana Harkin
0c0b0aa0f2 Fixes #2415 by creating a new instance of the Model when saving attributes to that model and the associated attributes already exist. Tests included. [#2415 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-27 16:35:03 +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
Carlos Antonio da Silva
7eedc3f397 Fixing test class names and refactor line in autosave association
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-07 10:45:47 +02:00
Ian White
b439d85a19 Nested records (re: autosave) are now updated even when the intermediate parent record is unchanged [#4242 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 16:13:00 +02:00
Mathieu Arnold
38da0ace77 Use primary key in conditions, not 'id' [#4395 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-04 22:45:08 +01:00
Pratik Naik
2ff5f38abb Ensure not to load the entire association when bulk updating existing records using nested attributes 2010-04-14 01:52:29 +01:00
Eloy Duran
9550916903 Raise a RecordNotFound if an ID in nested attributes is given but doesn't return a record. [#2415 state:resolved] 2010-01-07 13:19:49 +01:00
Eloy Duran
b6264c43f4 Moved the validation logic to the association reflection and refactored autosave_association.rb a bit. 2010-01-07 13:19:48 +01:00
Eloy Duran
fc6aae3459 Remove deprecated '_delete' option from NestedAttributes. 2010-01-07 13:19:48 +01:00
Eloy Duran
1afa9fa5a9 Refactored nested attributes a bit around :reject_if => :all_blank. 2010-01-07 13:19:48 +01:00
José Valim
dcafe995bf Make nested attributes behave like in 2.3.5 and add a sanity test for it with I18n. 2010-01-02 22:27:02 +01:00
Eloy Duran
c23fbd0d47 Refactored previous changes to nested attributes. 2009-12-28 21:09:22 +01:00
Michael Siebert
07b615fb89 Add an :update_only option to accepts_nested_attributes_for for to-one associations. [#2563 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-12-28 21:09:19 +01:00
Eloy Duran
9c771a9608 Make sure to not add autosave callbacks multiple times. [#3575 state:resolved]
This makes sure that, in a HABTM association, only one join record is craeted.
2009-12-28 16:56:31 +01:00
Pratik Naik
68d416a58f Add a :limit option to specify the maximum number of records that can be processed by accepts_nested_attributes_for 2009-10-09 16:08:11 +01:00
Pratik Naik
e94caf0788 Store entire options hash in the class var rather than just the reject_if proc for the nested attributes 2009-10-09 15:47:10 +01:00
Pratik Naik
0c27d0886e Use indifferent access attributes instead of stringifying them 2009-10-08 00:15:36 +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
José Valim
3091252aba Rename nested attributes _delete to _destroy to reflect its actual behavior and DSL (:allow_destroy). Deprecation warning added. [#2889 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:59:32 +02:00
Mike Breen
bcd0ef710e Raise an exception with friendlier error message when attempting to build a polymorphic belongs_to with accepts_nested_attributes_for. [#2318 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:37:54 +02:00
Wolfram Arnold
73f2d37505 Add test to verify that the new :inverse_of association option will indeed fix the validation problem for a belongs_to relationship that validates_presence_of the parent, when both the parent and the child are new (in-memory) records. Also check that this works when the parents adds child via nested_attributes_for.
Lastly, add a require 'models/pet' to association_validation_test.rb, so that test can be run independently (was failing due to that missing dependency). [#2815 status:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-08 13:07:49 +02:00
Jeremy Kemper
e8550ee032 Cherry-pick core extensions 2009-05-13 12:00:15 -07: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
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
Pascal Ehlert
455a7633db Nested attribute accessors should ignore new records with truthy _delete key.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1861 state:committed]
2009-02-06 13:36:59 +13:00
Michael Koziarski
fa7aa19a99 Don't rely on the order in these tests 2009-02-01 15:27:41 +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