asserting params intput and using ensure_resource
adding precondition