-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Just wanted to let you know I had some issues getting this setup when using a Postgres jsonb column...
My first implementation did not include a custom coder, and when updating a typed_store attribute, I got this error:
ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR: invalid input syntax for type json
DETAIL: Token "-" is invalid.
CONTEXT: JSON data, line 1: -...
: UPDATE "companies" SET "settings" = $1, "updated_at" = $2 WHERE "companies"."id" = $3
Which is because it was using the default yaml coder.
However, when I added the DumbCoder, I got a TypeError: can't cast Hash to error.
It was all solved by just using the JSON coder:
typed_store :settings, coder: JSON do |s|
s.boolean :foo, default: true, null: false
end
I think this would be useful to add to the readme...
Cheers!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels