Open ollieh-m opened 6 years ago
I have a suspicion that this might be adapted for how an older versions of Rails works. I’ll check when I get a chance! On Fri, 9 Mar 2018 at 21:53, Ollie Haydon-Mulligan notifications@github.com wrote:
When I run rails g statesman:active_record_transition Order OrderTransition, the migration created includes t.text :metadata, default: {}. This line causes the migration to fail with the error TypeError: can't quote Hash
Changing the line to t.json :metadata, default: {} allows the migration to complete.
Seems the migration generator shouldn't be defaulting the column to type text.
Rails 5.1.5 Statesman 3.4.1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gocardless/statesman/issues/313, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHFplY9kom0YiGDrt0dDA4iLh2nV8Khks5tcvnLgaJpZM4Sk690 .
I saw the same issue here. Fixed it locally by quoting the empty hash:
t.text :metadata, default: "{}"
I'm on MySQL here, so we cannot opt for the json column type.
@ollieh-m same here, using @ewlarson s fixx since with json i'm getting the following
Transition#metadata column type cannot be json and serialized simultaneously. If you are using a json column type, it is not necessary to include Statesman::Adapters::ActiveRecordTransition
When I run
rails g statesman:active_record_transition Order OrderTransition
, the migration created includest.text :metadata, default: {}
. This line causes the migration to fail with the errorTypeError: can't quote Hash
Changing the line to
t.json :metadata, default: {}
allows the migration to complete.Seems the migration generator shouldn't be defaulting the column to type text.
Rails 5.1.5 Statesman 3.4.1