I am using rails_admin for admin panel. Just change the association in the image model.
From this
class Image < ApplicationRecord
belongs_to :user
belongs_to :product
end
to that
class Image < ApplicationRecord
has_one :user
has_one :product
end
and user model
class User < ApplicationRecord
has_many :images,dependent: :destroy
end
Getting this error when I try to edit a user from the admin panel. On the other hand, it works fine.
ActiveRecord::StatementInvalid at /user/72/edit
PG::UndefinedColumn: ERROR: column users.image_id does not exist
LINE 1: SELECT "users".* FROM "users" WHERE "users"."image_id" = $1...
^
: SELECT "users".* FROM "users" WHERE "users"."image_id" = $1 LIMIT $2
source
share