MySQL BIT column type in ActiveRecord

I’m attempting to access a MySQL BIT(1) column with b’1’ as the data in
the case of a true boolean from within activerecord and am unable to get
any output. The table was created by Hibernate (which uses BIT as it’s
boolean type).

I’ve done a considerable amount of searching on this but have not been
able to find an answer. Am I missing something here or is this type of
field unsupported? The docs say it maps to a string type but I never
get any result when accessing the attributes and attempts at casting
haven’t gotten me anywhere.

Noah Dedmore wrote:

I’m attempting to access a MySQL BIT(1) column with b’1’ as the data in
the case of a true boolean from within activerecord and am unable to get
any output. The table was created by Hibernate (which uses BIT as it’s
boolean type).

I’ve done a considerable amount of searching on this but have not been
able to find an answer. Am I missing something here or is this type of
field unsupported? The docs say it maps to a string type but I never
get any result when accessing the attributes and attempts at casting
haven’t gotten me anywhere.

Nevermind on this… Figured it out… The spreadsheet I was putting
these in was removing the value due to the slashes used in the string
that was being returned.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs