在表单中编辑布尔值的序列化哈希的最佳方法是什么?

时间:2013-07-15 20:45:58

标签: ruby-on-rails forms serialization hash ruby-on-rails-4

所以我有一个名为“首选项”的表列。这只是布尔值的序列化哈希,因为唯一的偏好是用户是否想要针对某些操作发送电子邮件通知。

所以它就像

{
                  users: { role_granted: true  },

          owners_and_co: {  new_comment: true,
                               commited: true,
                              published: true,
                              submitted: true  },

                     co: {    submitted: true, 
                            deactivated: true,
                                deleted: true,
                           new_co_owner: true  },

    requirement_editors: {     commited: true,
                              deactived: true,
                                deleted: true  },

       resource_editors: {     commited: true,
                              deactived: true,
                                deleted: true,
                    associated_commited: true },

institutional_reviewers: {    submitted: true,
                            new_comment: true,
                      approved_rejected: true } 
}

我只想将此作为我表单上的复选框列表,但我不确定这是最干净的方法。任何帮助将不胜感激。

0 个答案:

没有答案