2

I want to store multiple column values in table.Lets take a example .. What are your favourite colors? the choices can be red,blue,green, orange. So lets assume, the user selects atleast 2 values.

Is there any way to store the multiple values in table. I have implemented by concatinating choices of users in a column in the table. I later found that it is a bad practise.

Currently i can think of using Bitwise operator and habtm.

What are the different ways for storing multiple choices values in table? If I am implementing in rails, What is the best way to implement this with OOP concepts? Is there any builtin options in rails?

1 Answer 1

1

The usual solution is to have a bridging table to create a many-to-many relationship.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.