Is it possible to create an attribute for a class that is an array? I tried reading this but I didn\'t get much out of it. I want to do something like this:
clas
If using Postgres, you can use its Array feature:
Migration:
add_column :model, :attribute, :text, array: true, default: []
And then just use it like an array:
model.attribute # []
model.attribute = ["d"] #["d"]
model.attribute << "e" # ["d", "e"]
This approach was mentioned by Marnen but I believe an example would be helpful here.