makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

Don't type cast mysql boolean as tinyint. Hopefully fixes #42 and #46. #52

Closed anthonyjsmith closed 8 years ago

anthonyjsmith commented 8 years ago

I encountered some problems when using boolean attributes with a mysql2 database adapter. Seemed to be because:

ActiveRecord::Base.connection.native_database_types[:boolean][:name]
#=> "tinyint"

and this was causing it to cast values to/from tinyint values (Fixnum) rather than to/from booleans.

I've stopped it from looking up native_database_type for booleans, and this seems to have fixed it. Also attempted to cover mysql2 in the tests (works locally, we'll see whether it works with travis...).

triskweline commented 8 years ago

Thanks for taking the time to work on the tests.

I merged this and added: