-
Notifications
You must be signed in to change notification settings - Fork 76
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
Broken behavior with boolean attributes in rails 4.2 #34
Comments
It only happens with mysql database and mysql2 adapter. |
It seems mysql2 adapter maps boolean values to 1-byte integer, so "false" gets converted to 0. Unfortunate as 0 is true in ruby. There is an obvious workaround (just checking for 0) but we would like it to be fixed... thanks in advance, this is a really great gem and we feel it specially useful for large applications, |
I'm afraid we cannot reproduce this issue. Closing this issue for now. If you'd like to reopen it, please submit a PR with a failing test. |
Have you tried your test with a Mysql database and mysql2 adapter instead of sqlite? |
I am also having this problem. Also using the mysql2 adapter. I've got the ActiveType test suite running with mysql2 and there are 24 failing tests. With the following change, I cleared up 10 of them:
I don't know if that's the right way to fix things, and it would be nice to clean up the other errors as well. Should I make an issue about getting the test suite running under mysql2? Or should this issue be reopened? |
Incomplete pull request: #35 |
After upgrade to rails 4.2, boolean attributes seem to be broken. Even if I do not check a checkbox, it is always interpreted as a "true" value. For instance, this validation always passes:
class AgreeForm < ActiveType::Object
....
attribute :agree, :boolean
validates :agree, :presence => true
end
Any clue?
The text was updated successfully, but these errors were encountered: