I have a has_many association and does some adding throug a nested
form, i can add objects (images) and edit text this works fine. But
when i try to delete items nothing happens. This is what my log looks
like:


Started POST "/photosets/168" for 127.0.0.1 at Fri Apr 15 07:34:04
+0200 2011
Processing by PhotosetsController#update as HTML
Parameters: {"commit"=>"Ändra Photoset",
"authenticity_token"=>"18nwmbNhushmQoXOLafzzjodbCoCtQMu22MG772Y8Xg=",
"utf8"=>"✓", "photoset"=>{"title"=>"en ny titel",
"photosetassets_attributes"=>{"6"=>{"_destroy"=>"false"},
"7"=>{"_destroy"=>"false"}, "8"=>{"_destroy"=>"false"},
"9"=>{"_destroy"=>"false"}, "0"=>{"id"=>"971", "_destroy"=>"false"},
"1"=>{"id"=>"972", "_destroy"=>"false"}, "2"=>{"id"=>"975",
"_destroy"=>"false"}, "3"=>{"id"=>"976", "_destroy"=>"1"},
"4"=>{"_destroy"=>"false"}, "5"=>{"_destroy"=>"false"}},
"credit_tokens"=>"1", "description"=>"dsadsad", "genre_ids"=>["1",
"2", "3"]}, "id"=>"168"}

And it looks to me as "3"=>{"id"=>"976", "_destroy"=>"1"} is marked
for _destroy here.

If i in the console write:
p = Photoset.last
f.update_attributes("photosetassets_attributes" => {"id" => "976",
"_destroy" => "1"})
p = Photoset.last.photosetassets

=> [#<Photosetasset id: 971, image: "20090818-img_0024.jpg",
photoset_id: 168, created_at: "2011-04-15 05:02:26", updated_at:
"2011-04-15 05:02:26">, #<Photosetasset id: 972, image:
"arvidsson0161.jpg", photoset_id: 168, created_at: "2011-04-15
05:02:26", updated_at: "2011-04-15 05:02:26">, #<Photosetasset id:
975, image: "2009_01_04_img_00000323.jpg", photoset_id: 168,
created_at: "2011-04-15 05:23:38", updated_at: "2011-04-15 05:23:38">]

And its deleted.

Please advice me what to do, have been working on this for the last
nights and i cant see whats wrong with it.

/Niklas


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to