Giorgio Gonnella wrote: > I have a table/model A which "has many" B (with :dependent > => :destroy). Now I was using with success active scaffold on A and I > wanted to use subforms to edit the associated B. > > I do not want to have any orphan Bs, therefore I even specified a > constraint :null => false on the a_id column of B. Unfortunately when > I delete an associated B record, active scaffold does not destroy it, > rather it tries to set a_id to NULL, which of course goes against the > constraint. > > The source of the problem is of course in the > ActiveScaffold::AttributeParams::update_record_from_params method of > lib/attribute_params.rb (although this is a quite sofisticated method, > what prevented me for understanding yet the exact point in which the > column is set to NULL, but I'm working on it :D ). > > Is there a simple way to destroy the record instead of trying to set > the association column to NULL? Or should one override > update_record_from_params to obtain this? > > I think this is a quite generic problem, so maybe someone have already > a solution (or I missed something in the APIs documentation?) >
Sounds like a bug - perhaps plug away and see if you can fix it? Ed --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
