vhochstein / active_scaffold

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

params[:attribute] nil Object and not empty Hash with record_select only form #167

Closed nakedmoon closed 13 years ago

nakedmoon commented 13 years ago

record_select form helper not submit attribute name with no records selected on many_to_many and one_to_many associations. When the attribute configured with record_select and it is the only one, params[:record] is a nil Obejct instead of a empty Hash. The effect id that update_save call update_record_from_params with params[:record] nil instead of empty Hash, and update_record_from_params can't be able to iterate on a nil Object.

I temporary solved the problem overriding the do_update method in my controller:

def do_update do_edit +params[:record] ||= {} update_save end

vhochstein commented 13 years ago

Thanks a lot for reporting should be fixed.