-
I'm wondering if how to think about associations and hooks, specifically the protect() hook. On my I have an
the password IS sent to the client. It seems the hooks in Am I thinking about this incorrectly to expect before and after hooks for user to run when I include it as an association? Is there a good way to protect the password field from being exposed when included as an association on another service? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Digging in some more, looks like my question was based on misunderstanding. Associations happen at the model-level, while hooks happen at the service-level. Hooks run based on which service is called. Other models can be included as part of that, but that will bypass the hooks and service of that included model. In this case, adding |
Beta Was this translation helpful? Give feedback.
Digging in some more, looks like my question was based on misunderstanding. Associations happen at the model-level, while hooks happen at the service-level. Hooks run based on which service is called. Other models can be included as part of that, but that will bypass the hooks and service of that included model.
In this case, adding
protect('author.password')
to the articleafter.all
hook prevents the password from getting out.