I set the id of the Filter object to nil and everything gets updated now. Is this normal and should it work like this?
On Friday, 31 May 2013 13:52:57 UTC-4, Paul wrote: > > Hi, > > Here is my problem. I have a model that has a 1-1 association implemented > using dm-accepts-nested-attributes: > > class Message > > attribute_accessible :filter_attributes > > has 1, :message_filter, :constraint => :destroy > > has 1, :filter, :through => :message_filter, :via => :filter > > accepts_nested_attributes_for :filter > > end > > class Filter > > property :format, String > > end > > When I try to update a message: > > message.update(params[:message]) > > I get the error message: > > PRIMARY KEY must be unique (code: 19, sql state: , query: INSERT INTO > "filters" (....)) > > Why is it trying to do an insert instead of doing an update? > > Paul > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+unsubscr...@googlegroups.com. To post to this group, send email to datamapper@googlegroups.com. Visit this group at http://groups.google.com/group/datamapper?hl=en. For more options, visit https://groups.google.com/groups/opt_out.