I've found a good way to store some data in the database with a binary sequence, like 0b0101000 and find rows that give a positive result after applying a mask.
For exemple : SELECT (0b0101010 & (1<<3 | 1<<5))>0; allows me to get rows with the 3rd or 5th bit on, no matter if the others bits are on or off.
The problem is when I want to do this with ActiveRecord.
This migration add_column :table, :column, :binary, :limit => 8.bytes creates in fact a TINYBLOBcolumn and not a BINARY or VARBINARY and I can't apply my mask to its value because it is not considered a binary value.
I know that I could make the right column format in the migration by executing a raw SQL statement and then query my table with raw SQL segments for this part, but it doesn't seems like "the Rails Way".
Thanks for any idea.