私はこのテーブルを持っている:["Manufacturer,4", "Retail,6"]
のようなので、Postgresのクエリは
create_table "packages", force: :cascade do |t|
t.string "sender_type"
t.integer "sender_account_id"
t.integer "sender_user_id"
t.string "address"
t.text "type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "recipients", array: true
end
受信者の列は、カンマで区切られたモデルタイプとidを取ります。私のどこクエリで
は、私は言葉「メーカー」との任意の受信者が含まれるパッケージを見つけるために探しています:
Package.where("sender_type = ? and recipients.include = ?", "school", regex).
私はどこにも近いこの
大変感謝しています!私は全体のコンセプトを捨ててしまった。 – daveasdf