Rails bitwise, enum with super powers
Charly Poly
784

Hi! I’d like to try your solution for storing several values in JSONB column (I’m on Postgresql 9.5) as an array.

For simple String field I can do something like this:

post = Post.first
post.update(tags: [‘super’, ‘5 stars’]) #Let’s assume “tags” is JSONB field where whatever string values can be placed

With Rails Enum at the moment I can store only one value like this:

post = Post.first
post.update(post_type: 2) #Let’s assume “post_type” is JSONB field with several enums attached in Model

Can you give any hint, how to pass two or more attr_bitwise values for “post_type”, please?