search for: find_by_valu

Displaying 1 result from an estimated 1 matches for "find_by_valu".

Did you mean: find_by_value
2006 Aug 08
12
delete_if doesn''t work for has_and_belongs_to_many
...class Thing has_and_belongs_to_many :items end i = Item.new i.things << Thing.new( :value => "Something").save i.things << Thing.new( :value => "Something Else" ).save i.save Fine, now I have two records in the items_things table. Now if I say t = Thing.find_by_value ''Something'' i.things.delete t i.save Then I have only one record in the items_things table. Which is correct. But, if I had said i.things.delete_if {|x| x.value = ''Something''} i.save then the relevant record is not deleted from the items_things table. Is thi...