Slick23
Slick23

Reputation: 5897

Heroku doesn't set boolean field in rails app

It's passing the parameter as replacement_emails, which is correct. From the log:

Parameters: {"utf8"=>"✓", "authenticity_token"=> ... "replacement_emails"=>"1"}, "commit"=>"submit", "id"=>"1"}

But it's not getting set in the database. No error message in the log, nothing. It works in development with SQLite.

Any thoughts? On why it works in development but no in production on Heroku?

Upvotes: 1

Views: 357

Answers (2)

Gary Wright
Gary Wright

Reputation: 121

I came across your question today when I had a similar problem and may be able to explain what was going on.

Running Rails migrations on Heroku doesn't automatically cause your application to restart and so your new code may be seeing an old view of the database via its existing database connection. This can cause some strange behavior (like accessing a column that didn't exist until the migration executed).

A manual restart of the application will cause it to reconnect to the db and see the changes.

A rollback or redeployment will also cause the application to restart and reconnect to the database.

Just remember to restart your application after running rails migrations.

Upvotes: 2

Slick23
Slick23

Reputation: 5897

After doing a rollback of the deployment, then re-deploying -- it just suddenly works. Not sure what was wrong.

Upvotes: 1

Related Questions