I have a problem in trying to link a stand with two checkboxes which are resident & communication, and they seem to be stored separately if more than one stand is choosen.
If I have one stand the parameters seem to be stored in the correct manner inside a hash of an array, but once I add another stand to that same array it seems to swap the hashes.my view is like this. And you have another option of adding another stand which calls the same partial which is:
- unless @stands.empty? %tr#show_stands.contentText %td{:width => "27%", :valign => "top"} Select Stand For Ownership %td{:width => "15%", :valign => "top"} = collection_select "owned_stands[]", "stand_id", @stands, :id, :erf_no_rr_no, options ={:prompt =>"Please select stand..."}, {:class => 'dropdownSelect'} %td{:valign => "top"} = check_box_tag "owned_stands[][owner_comm_list]" Add to Owners Communication list = check_box_tag "owned_stands[][resident_comm_list]" Add to Residents Communication list
I am expecting an array that contains a two hashes or more depending on the number of stands that I have selected. If I have selected one stand and both checkboxes I expect the hash lie:
([{"stand_id" => "1", "resident_comm_list" => "1", "owner_comm_list" => "1"}])
And if I have two I expect:
([{"stand_id" => "1", "resident_comm_list" => "1", "owner_comm_list" => "1"},{"stand_id" => "2", "resident_comm_list" => "1", "owner_comm_list" => "1"}])
But now if I select two stands I find:
([{"stand_id" => "1", "resident_comm_list" => "1"}, {"owner_comm_list" => "1"},{"stand_id" => "2"},{"resident_comm_list" => "1", "owner_comm_list" => "1"}])
And it is giving me errors inside my controller when I have to loop through the hashes to select the stand_id.