MishkaCmsMigration. Resources. Validations. MappedRecord
(Mishka CMS Migration v0.0.1)
Copy Markdown
View Source
Holds an item's mapped_id (MishkaCmsMigration.MigrationItem's :choose) to a record the item
may be mapped to: one of the CMS resource its kind is written to (MishkaCmsMigration.Target),
on the item's site, that the admin may read. nil, importing the item as its own, is always
taken.
update :choose do
validate MishkaCmsMigration.Resources.Validations.MappedRecord,
before_action?: true,
where: [changing(:mapped_id)]
endThe record is read as the admin, under the item's site and the CMS's own policies
(MishkaCmsMigration.Targets.Helpers.Read), so another site's record, another kind's, one that
is gone and one the admin may not read are all refused the same way, on mapped_id. Run it with
before_action?: true, after the policies have let the admin make the choice.