I have a an AR object model/table with a bit field of size 7. When
creating a new record rails has no problem if I just specify an integer
value in place of the bit field value (ideally it should be able to
handle b''1010101'' as mysql does). Pulling the data out of
the table
is a bit strange. I''ve been experimenting with
model.field.unpack(''B*''). This should return all the bits in
the
field, which I would assume is a string of 7 bits. However, this isn''t
the case. Instead it returns a string of 8 bits. Using
unpack(''B7'')
it chops off the least significant bit. Apparently there is a
''0'' bit
appended to the bit string in the place of the most significant bit.
I''m not sure if this is an issue with Rails'' ActiveRecord,
ruby, mysql
5, my ignorance or some combination of these.
Does anyone have any ideas or an explanation?
Thanks,
John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---