This project is archived and is in readonly mode.
[PATCH] accepts_nested_attributes_for should not redefine the attribute writer
-
Eloy Duran
I'm not sure I understand what the use would be. It makes it so you can use
accepts_nested_attributes_for :redaction', yet it won't create the writer method, so what good is it? -
Gaspard Bucher
I should have read through the whole nested_attributes.rb file a little slower.
My case can be solved with a simple :autosave => true on the association instead of using accepts_nested_attributes_for.
Sorry. Forget about my patch.
Just a warning on the tests: they are order dependent:
if "test_should_disable_allow_destroy_by_default" is run before "test_should_be_possible_to_destroy_the_associated_model" it will fail since the first test modifies the Pirate class.
It might be a good idea to keep the SpecialPirate class from the patch for this issue.
-
Eloy Duran
Ah you wanted the :autosave behaviour :) You can checkout autosave_association.rb for its source.
That's weird, the teardown should fix that:
def teardown Pirate.accepts_nested_attributes_for :ship, :allow_destroy => true endI'll have a look later on though, thanks for the heads up.
-
Gaspard Bucher
Eloy... forget about me.
I bumped on this and am not at all used to class changes in the teardown so I didn't look there first. I just had strange side effects while testing the patch but there's no need to investigate more.
Thanks for the responses. Closed for me.
-
Eloy Duran
Ah ok, no problem :)
Unfortunately I can't close any tickets, or have tickets assigned to me for that matter…
-
Eloy Duran
- State changed from new to invalid
- Assigned user changed from Michael Koziarski to Eloy Duran
