For some reason a deleted child still has the status of “published,” why??? If it is deleted shouldn’t the status change? As a result, I have to probe for a non-nil deleted_at (which is super annoying). Am I missing something?
So wait… I have to empty the trash for it to go away? Fine, but the status should still change. Status still should not be “published” if it’s in the trash in my opinion.
The published state and deleted state are two different things. When you delete a node, all of it’s descendant children have their
deleted_at timestamp touched, but their
published_at timestamp remains unchanged.
This allows you to restore deleted nodes and retain the original published date.
Deleted nodes shouldn’t ever appear on the front end, but if you’re doing any of your own queries in your
ApplicationController or in your veiws, then make sure you’re always using the
Node.published scope as this ensures the node isn’t trashed.