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

Cast column default value to int before comparing with position column #129

Merged
merged 1 commit into from
Sep 25, 2014

Conversation

wioux
Copy link
Contributor

@wioux wioux commented Aug 25, 2014

This fixes an issue resulting from Model.columns_hash['position'].default being returned as a String object. Since send(position_column) returns the default value after casting, the comparison in default_position? fails.

Seen while running Rails 4.2.0beta1 with a Postgres database.

irb(main):003:0> pp LineItem.columns_hash['position'].default
"0"

swanandp added a commit that referenced this pull request Sep 25, 2014
Cast column default value to int before comparing with position column
@swanandp swanandp merged commit 7e1cf6f into brendon:master Sep 25, 2014
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 this pull request may close these issues.

2 participants