Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: can't quote Hash when running transition table migration #313

Open
ollieh-m opened this issue Mar 9, 2018 · 3 comments
Open

Comments

@ollieh-m
Copy link

ollieh-m commented Mar 9, 2018

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

@timrogers
Copy link

timrogers commented Mar 9, 2018 via email

@ewlarson
Copy link

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.

@t3k4y
Copy link

t3k4y commented May 7, 2018

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants