# MySQL BIT column type in ActiveRecord

**URL:** <https://www.ruby-forum.com/t/mysql-bit-column-type-in-activerecord/174976>\
**Category:** Rails\
**Created:** [September 5, 2009, 1:23am UTC](https://www.ruby-forum.com/t/mysql-bit-column-type-in-activerecord/174976 "2009-09-05T01:23:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndaniels](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c67d28/32.png) [@ndaniels](https://www.ruby-forum.com/u/ndaniels)\
**Post date:** [September 5, 2009, 1:23am UTC](https://www.ruby-forum.com/t/mysql-bit-column-type-in-activerecord/174976/1 "2009-09-05T01:23:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ndaniels](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c67d28/32.png) [@ndaniels](https://www.ruby-forum.com/u/ndaniels)\
**Post date:** [September 5, 2009, 1:44am UTC](https://www.ruby-forum.com/t/mysql-bit-column-type-in-activerecord/174976/2 "2009-09-05T01:44:42Z")

</div>

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.
