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

Report the attribute on ActiveRecord::SerializationTypeMismatch #27773

Merged
merged 1 commit into from Jan 30, 2017

Conversation

Projects
None yet
7 participants
@kirs
Member

kirs commented Jan 23, 2017

Today when you get ActiveRecord::SerializationTypeMismatch it doesn't give you a tip about what attribute caused the error. This is not user friendly:

screen shot 2017-01-22 at 22 39 03

I think we should report it together with the error.
Regarding the implementation, I had to catch SerializationTypeMismatch on one level up in Attribute because that's where we know the attribute name. SerializationTypeMismatch is raised from a coder that has no idea about the attribute name.

@sgrif @kaspth

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Jan 23, 2017

r? @chancancode

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Jan 23, 2017

r? @chancancode

(@rails-bot has picked a reviewer for you, use r? to override)

@maclover7

This comment has been minimized.

Show comment
Hide comment
@maclover7

maclover7 Jan 23, 2017

Member

Please take a look at the Travis CI build when you get a chance.

Member

maclover7 commented Jan 23, 2017

Please take a look at the Travis CI build when you get a chance.

@eileencodes

This comment has been minimized.

Show comment
Hide comment
@eileencodes

eileencodes Jan 23, 2017

Member

@maclover7 the failure isn't related to this branch, it's failing on all new PRs. Something on the env side got updated.

Member

eileencodes commented Jan 23, 2017

@maclover7 the failure isn't related to this branch, it's failing on all new PRs. Something on the env side got updated.

Show outdated Hide outdated activerecord/lib/active_record/errors.rb
Show outdated Hide outdated activerecord/lib/active_record/attribute.rb
Topic.serialize :content, Hash
topic = Topic.create!(content: { zomg: true })
Topic.serialize :content, Array

This comment has been minimized.

@kaspth

kaspth Jan 23, 2017

Member

Won't this leak into other tests?

@kaspth

kaspth Jan 23, 2017

Member

Won't this leak into other tests?

@kirs

This comment has been minimized.

Show comment
Hide comment
@kirs

kirs Jan 29, 2017

Member

@kaspth thanks for review! I updated the code. Now YAMLColumn accepts attribute name.

Member

kirs commented Jan 29, 2017

@kaspth thanks for review! I updated the code. Now YAMLColumn accepts attribute name.

@rafaelfranca rafaelfranca merged commit 6bf6957 into rails:master Jan 30, 2017

2 checks passed

codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@maclover7 maclover7 removed the needs work label Jan 30, 2017

@kirs

This comment has been minimized.

Show comment
Hide comment
@kirs
Member

kirs commented Jan 31, 2017

cc @jules2689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment