Keeps a post's publish times in step with its :status.
- A post whose status is
:publishedand that has no:published_atgets the current time, truncated to the second. - A post whose status is
:scheduledand that has no:scheduled_publish_atis refused with an error on that field. - Any other status is left alone.
On a create it applies to every post. On an update it applies only when the status is changing, so
saving an already published post never moves its :published_at.
Usage
create :create do
change MishkaBlog.Resources.Changes.PublishLifecycle
end
update :update do
change MishkaBlog.Resources.Changes.PublishLifecycle
end