# `MishkaBlog.Resources.Validations.OpenToActor`
[🔗](https://github.com/mishka-group/mishka_blog/blob/v0.0.1/lib/mishka_blog/resources/__validations/open_to_actor.ex#L5)

Refuses a write onto a record its actor may not open — a comment, a rating or a bookmark on a
locked post, a vote on a comment of one — with the message the action gives for a record that is
not there, so the refusal tells nothing a reader may not know. Who may open it is what its page
asks (`MishkaBlog.Resources.Preparations.OpenToActor.opens?/2`).

    validate {OpenToActor,
              field: :post_id,
              resource: MishkaBlog.BlogPost,
              lock: :effective_permissions,
              message: dgettext_noop("errors", "Post not found or does not belong to your site.")}

A call made with `authorize?: false` is not checked, and a record that is not there is left to the
action's own check of it.

## Options

* `:field` - Required. The attribute naming the record.
* `:resource` - Required. The resource it names.
* `:lock` - Required. The attribute or calculation holding the permissions that record opens with.
* `:message` - Required. The refusal.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
