Artificial intelligent assistant

配列の要素を持つモデルに対して関連付けを書く方法を教えてください InquiryTypeInquiryContentRails InquiryType: class CreateInquiryTypes < ActiveRecord::Migration def change create_table :inquiry_types do |t| t.string :name t.timestamp :created_at end end end InquiryContent: class CreateInquiryContents < ActiveRecord::Migration def change create_table :inquiry_contents do |t| t.string :name, null: false t.string :mail_address, null: false t.integer :inquiry_type_id, array: true t.string :content, null: false t.timestamp :created_at end end end InquiryContentinquiry_type_idInquiryTypeid InquiryContent`inquiry_type_id``[1, 3, 4, 5]` `InquiryContent.first.inquiry_type`InquiryType InquiryContent`belongs_to :inquiry_type` InquiryType`has_many :inquiry_contents` `InquiryContent.first.inquiry_type``nil`

Rails **** `InquiryContent#inquiry_types` InquiryType


class InquiryContent < ActiveRecord::Base
...
def inquiry_types
InquiryType.where :id => inquiry_type_id
end
end


Rails () PostgreSQL "" `has_many :through` N:N

: Active Record ()

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy d860970f28e2d6341346ec4e318e7190