I have a users table with a bitmask field that has a permissions mask in it. Locally, I can determine whether a user has a certain permission by doing a bitmask (UserPermissions&Perm)==Perm
. However, I want to be able to issue a find_by_mask
or something similar, perhaps using a :conditions
, but I can't seem to find out how I can query the database to retrieve a list of users with a matching permission mask.
Any ideas using ActiveRecord?
Specifically this must work using sqlite and postgres