Recently I found a nice feature when defining a column on migrations, is to use array option in the creation of a column:

class MyMigration < ActiveRecord::Migration[5.2]
  def change
    # Defines a column that stores an array of a type.
    add_column :transactions, :categories, :string, array: true, default: []
  end
end

With this on categories you can storage an array of values, it’s useful instead of use jsonb because as json you may also need to create the key to store values (hash).

this is how to use:

record.categories = ["food", "travel"]
record.save