Skip to content

protect() the password field when user model included as association #2316

Answered by rxb
rxb asked this question in Q&A
Discussion options

You must be logged in to vote

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 article after.all hook prevents the password from getting out.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tvld
Comment options

Answer selected by rxb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants