determining checked checkboxes

If I understand you correctly, then in your controller you would like an array of the checked items which you will access from params.

I have recently done this for assigning roles to users:

My controller action looked like this:

def assign_roles
user_roles = params[:role]
user_roles.each do |job|
UserRole.create(:user_id => params[:user_id], :role_id => job.to_i)
end
redirect_to ‘somewhere else’

end

The params[:role] in this case is an array of checked options from the form. To see how this is achieved here is the view code:

    <% for role in @roles %>
        <tr>
            <td><%= role.role_type %></td>
            <td><%= check_box_tag "role[]", [role.id](http://role.id), checked=false %></td>
        </tr>
    <% end %>

As you can see, the name for the check_box_tag is an array - role[]. The value that is returned is the id of the role (as a string - hence the to_i after job in the controller).
The value is only returned if the checkbox is checked so you get an array of all the checked id’s.

Regards
Ivor