2 つのモデルがPostあり、PostCategoryどちらにもhas_and_belongs_to_many関係があります。
、 、およびの 3post_categoriesつを手動で作成しました。newsdon't missannouncements
新しいものを作成するときに、 withを介してそれpostを選択できるようにしたいと考えています。categoriesbelongs toselectmultiple="true"
注意: 作成時に新しいを作成するのではなくcategory、これpostに 1 つまたは複数categoriesを追加しますpost。