How would you store roles with up to 64 permissions?

This page summarizes the projects mentioned and recommended in the original post on /r/rails

Our great sponsors
  • PopRuby - Clothing and Accessories for Ruby Developers
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • CanCanCan

    The authorization Gem for Ruby on Rails.

    Would you do : 1. a roles table with the name of the role and 64 booleans? 2. A roles table with one JSON field? (using rails json data type) 3. A roles table and a permissions table, similar do what is suggested in the cancancan developpers guide:

  • activerecord-typedstore

    ActiveRecord::Store but with type definition

    I guess it depends on how frequently the roles or flags change, but we use https://github.com/byroot/activerecord-typedstore and a jsonb field. We add flags as needed and cache them, but also things like role limits, without the need for db migrations or a hefty load of columns.

  • PopRuby

    PopRuby: Clothing and Accessories for Ruby Developers. Fashion meets Ruby! Shop our fun Ruby-inspired apparel and accessories designed to celebrate the joy and diversity of the Ruby community.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts