Currently, the initialization template drops WCC::Contentful.validate_models! in the initializer wcc-contentful.rb. This means it gets run during every task that requires the Rails environment, not just rails server.
i.e. rails console, rake db:migrate etc. will fail if model validation fails.
Realistically, we want this to be a built-in-test that runs on deployments, after Contentful migrations have happened. This means it should be executed by Heroku inside bin/release, not on app startup.
Create a rake task that validates the models, and then update the sample bin/release such that it inserts the following commands before rake db:migrate:
$DIR/contentful migrate -y
bundle exec rake wcc:contentful validate # or whatever you want to name it
Currently, the initialization template drops
WCC::Contentful.validate_models!
in the initializerwcc-contentful.rb
. This means it gets run during every task that requires the Rails environment, not justrails server
.i.e.
rails console
,rake db:migrate
etc. will fail if model validation fails.Realistically, we want this to be a built-in-test that runs on deployments, after Contentful migrations have happened. This means it should be executed by Heroku inside
bin/release
, not on app startup.Create a rake task that validates the models, and then update the sample
bin/release
such that it inserts the following commands beforerake db:migrate
: