Rails 5: (Object doesn't support #inspect) when serializing text column

656 views Asked by At

I'm building a rails 5 api only app, working with a postgres database created from a rails 4 app.

In rails 4, I could easily include serialize :column_name on a model to turn a text column into a hash. However, when I do this in rails 5, active record returns (Object doesn't support #inspect) when I try to get an object.

Here's my model...

class Integration < ApplicationRecord
  belongs_to :website, optional: true
  serialize :api_data
end

And this is what happens when getting an integration object...

integration = Integration.last
  Integration Load (3.9ms)  SELECT  "integrations".* FROM "integrations" ORDER BY "integrations"."id" DESC LIMIT $1  [["LIMIT", 1]]
(Object doesn't support #inspect)

Here's how the integrations table looks...

create_table "integrations", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "integration_type"
    t.text     "api_data"
end
0

There are 0 answers