vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

Deleting subform plural association last record #195

Closed vtt closed 12 years ago

vtt commented 12 years ago

Hi,

I am having trouble deleting the last record of a plural association in subform edit view. Deleting the association records in subform edit view works fine as long as there is at least 1 remaining association record.

The "X" delete button removes the record from the view, but when clicking "Update", the last record is not removed.

This problem exists in branch 'rails 3.0' active_scaffold_vho 3.0.25

vhochstein commented 12 years ago

Do you use prototype or jquery?

vtt commented 12 years ago

I am using JQuery

vhochstein commented 12 years ago

Have you already done an analysis why this is failing?

vtt commented 12 years ago

Yes, the reason for it to fail is because I set "show_blank_record = false". You can verify this with your "howto" application for Rails 3.0 and add the below code to the Team controller. Add two players to the same team, and try to remove the last player from the team edit view.

ActiveScaffold.set_defaults do | config | ActiveScaffold::DataStructures::Column.show_blank_record = false end

vtt commented 12 years ago

If "show_blank_record = true", then everything works correctly. So there's a problem with removing associated records in subforms edit view when this setting is set to false.

vhochstein commented 12 years ago

Yes, you are right! Will have to think about how to fix this...

vhochstein commented 12 years ago

I hope I ve fixed this issue with my last commit. Can you please check?

vtt commented 12 years ago

Thanks for fixing this. The problem has been resolved.