[Rails-core] Re: Deleting records using nested attributes decreases the counter cache twice

2009-06-06 Thread lobo_tuerto
Ah! thank you a lot :) Works flawless now. Best regards. On 5 jun, 10:29, Luca Guidi wrote: > 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: > > per

[Rails-core] Re: Deleting records using nested attributes decreases the counter cache twice

2009-06-05 Thread Luca Guidi
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 =>

[Rails-core] Re: Deleting records using nested attributes decreases the counter cache twice

2009-06-04 Thread lobo_tuerto
Ah!, forgot to mention that the count then goes from 1 record to -1 records. --~--~-~--~~~---~--~~ 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@googlegr

[Rails-core] Re: Deleting records using nested attributes decreases the counter cache twice

2009-06-04 Thread lobo_tuerto
I'm using Rails 2.3.2, on Ubuntu 8.10. Ok, here is a capture of the "params" sent to create a record, with the nested params: # URL: http://localhost:3000/compras/create # Compra params compra[fecha] 2009-06-04 compra[proveedor_id]1 compra[condicion_de_pago] 15 dias compra[fecha_de_pa

[Rails-core] Re: Deleting records using nested attributes decreases the counter cache twice

2009-06-03 Thread Luca Guidi
Hi, please can you specify which version of Rails are you currently using, and an example of the code that causes your problem? I tried to reproduce it with: compra.update_attributes :detalle_de_compras_attributes => [{:id => 953125641, :_delete => true}] but works fine for me, it decrements t