mltsy
unread,Jan 26, 2012, 10:27:59 AM1/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DataMapper
I'm wondering if the _destroy option for forms actually works with dm-
ANA the same as in ActiveRecord... ?
I have a model with:
accepts_nested_attributes_for :answers, :allow_destroy => true
and then in the form, inside the f.fields_for :answers block I have a
checkbox:
a.check_box, :_destroy
And whenever I load that page, I get an error the first time:
undefined method `to_i' for #<DataMapper::Resource::State::Immutable:
0x97f4794>
and the second time, all the answers are just gone. So it seems like
it's calling destroy on all the answers in the process of trying to
render the page... ?? Am I doing something wrong? Does dm-ANA not
support _destroy? I get the same weird results minus the error by
using simply :destroy (it destroys the object while rendering the
page). Do I need to do something in the Answer model perhaps?