Filtering MySQL data by rails session parameter -
i've got rails application, backed mysql. it's using row-level permissions model. i.e. have few columns (permission1, permission2, permission3) on table called projects , need check if user has details of permissions can access in session can see data queried projects table , filter out if don't.
i on case case basis, i'm looking generic (i) works other tables might add permissions model later , (ii) if run projects.all somewhere , forget add appropriate clause don't accidentally show data user doesn't have permission view it.
previously i've used modified jdbc driver in java webapp, don't know equivalent solution should rails + mysql.
just discovered default_scope, should sufficient on per-model basis. that's close enough.
Comments
Post a Comment