Adding :dependent => :destroy to your "a" has_many association should do the trick.
On Nov 15, 4:06 pm, p k <[email protected]> wrote: > Thanks for the reply Sergio. It did point me in the right direction > where I had 'b' as one of the columns in the a_controller, instead of > a_b. > > Now all updates work fine except when I remove an association between > a and b. Say I remove a value "b3" associated with "a1", in the a_b > table, the value for b_id is changed to NULL instead of deleting this > row. In other words, the association is not destroyed, but one of the > values is changed to NULL. > > How do I configure this to destroy the row in the join table, rather > than storing the id as NULL? > > Thanks, > PK > > On Nov 15, 3:30 am, "Sergio Cambra .:: entreCables S.L. ::." > > <[email protected]> wrote: > > On Viernes, 12 de Noviembre de 2010 16:32:51 p k escribió: > > > > I'm using Rails 2.3 and the AS plugin for the same branch (2.3). This > > > worked fine till now, but for reasons beyond my control, I need to > > > convert my existing HABTM associations to has_many through > > > associations. > > > > I have made the corresponding changes (has_many through) in my > > > original models (say, a and b) and added a third model (a_b) for the > > > association table. I also added an autoincrement id column to the > > > association table. > > > > The list of entries in the database for model a still show up fine > > > but, now when I try to edit the list of associated entries (model b) > > > that model a points to, the form submits fine, but does not update > > > anything. It shows the same original list of associated entries. > > > > Do I need to make any other changes to get this working? Or does AS > > > only support HABTM associations? > > > Has many through should work. Are you excluding a_b column? Is sent form > > data > > right? You can get it in log file. > > > -- > > Sergio Cambra .:: entreCables S.L. ::. > > Mariana Pineda 23, 50.018 Zaragoza > > T) 902 021 404 F) 976 52 98 07 E) [email protected] -- 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.
