-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store User Roles as Bitmask, Not Relation #272
Conversation
Barring objections from anyone who's worked with the Role code (@mehulkar ?) I'm going to run this against my test database in dev, make sure it doesn't horrificially break anything, then deploy this weekend. |
Interesting. The point of this to cache a users roles in the users table? |
And simplify adding roles. They'll be defined in code, rather than the DB. We're not at the level where having dynamic role creation is terribly useful. |
Speeds up queries too I guess. Does this completely remove the need for the roles table? |
Yup. and makes them easier to write. No more joining on four different tables to figure out who should show up on a page! I may have made this change primarily because I was too |
Yeah I've had that problem before. This is cool. Wish I had found this gem 6 months ago :) |
The sad part is I wrote the code to do exactly what the gem does, then found out it existed and already had tests and was properly modularised 👎… I was so excited to finally use my knowledge of bitwise operators |
Model user roles as a bitmask on the User record, not a relation. Incldues migration rake task that converts between the old and new formats.
Model user roles as a bitmask on the User record, not a relation. Incldues migration rake task that converts between the old and new formats.
Model user roles as a bitmask on the User record, not a relation. Incldues migration rake task that converts between the old and new formats.
No description provided.