0

I have a Rails 5.0.2 app running PostgreSQL 9.6 on Heroku with the following model:

create_table "stories", force: :cascade do |t|
  t.string   "title",                     default: "",    null: false
  t.datetime "created_at"
  t.datetime "updated_at"
  t.boolean  "image_processing"
  t.jsonb    "image_json"
  t.string   "image_file_name"
  t.string   "image_content_type"
  t.integer  "image_file_size"
  t.datetime "image_updated_at"
end

In my app, I assume that image_json is a Hash. So when I call Story.last.image_json.class, I expect the output to always be Hash, which holds true in my development environment. When I run the same command on production (Heroku), the output is not Hash, but rather String. How is this possible?

On localhost:

Story.last.image_json.class
=> Hash

On production:

Story.last.image_json.class
=> String

At first I thought that perhaps it was because I was running a slightly older version of Postgres in development (9.4) than on production, but upgrading both Postgres installs to 9.6 had no effect.

I've temporarily solved the issue by simply checking the class of image_json in my code before operating on it, but that doesn't really solve my problem.

Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88

1 Answers1

1

It's a Rails 5.0.2 problem - issue