You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this has partially been reported already #171 but I think what proposed @ribordy is kinda nice. I would even imagine one step further like
classDemoResourceattribute:name,:string,readable: :readable?,writable: :writable?attribute:role:string,readable: :readable?,writable: :writable?defreadable?(attr)policy(model_instance).permitted_read_attributes.include?(attr)enddefwritable?(attr)policy(model_instance).permitted_write_attributes.include?(attr)endendclassDemoPolicydefindex# some logicenddefupdate# some logicenddefpermitted_read_attributes=%i[namerole]defpermitted_write_attributesifuser.admin?%i[namerole]else%i[name]endendend
That way we can leverage Pundit for what they call "permitted_attributes" too and have the read+write permissions at the same place => in the policy file, where I think it belongs.
Would that make sense?
The text was updated successfully, but these errors were encountered:
Hello,
I know this has partially been reported already #171 but I think what proposed @ribordy is kinda nice. I would even imagine one step further like
That way we can leverage Pundit for what they call "permitted_attributes" too and have the read+write permissions at the same place => in the policy file, where I think it belongs.
Would that make sense?
The text was updated successfully, but these errors were encountered: