class Category < ActiveRecord::Base
serialize :blocked_user_ids, Array
end
View:
<%= collection_check_boxes(:category, :blocked_user_ids, User.all, :id, :full_name) %>
The id of a blocked user is stored in the serialized attribute blocked_user_ids.
Passing checked/unchecked boxes for all users with collection_check_boxes to the controller works perfectly.
I wonder though how to show a checked box for each id that is stored in the blocked_user_ids array?
Aucun commentaire:
Enregistrer un commentaire