MishkaBlog.Resources.Validations.NotItsOwnParent (Mishka Blog v0.0.1)

Copy Markdown View Source

Refuses an update that makes a record its own parent: the attribute :field may not hold the record's own id. Any other record, or none, is let through. The refusal is :message on :field.

validate {MishkaBlog.Resources.Validations.NotItsOwnParent,
          field: :parent_tag_id,
          message: dgettext_noop("errors", "Tag cannot be its own parent.")}

It reads the id of the record being updated, so it belongs on an update action.

Options

  • :field - Required. The attribute holding the parent's id.
  • :message - Required. The refusal.