Hi, just gave a look at your code, the problem is trivial: you shouldn't call both #update_attributes *and* #save, because they performs the same operation. The former is a syntax shortcut:
person.name = "luca" person.age = 26 person.save # or person.update_attributes :name => "luca", :age => 26 So, updating *twice* your record, the detalle de compras counter will be decreased assuming the value of -1. Cheers, Luca -- blog: www.lucaguidi.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---