Rails 4 has_and_belongs_to_many
问题 I have two models. Venues and Categories. They are related to each other as has_and_belongs_to_many Categories are pre populated and in the form i want to display a multi-select to allow choosing the categories for a venue while adding a venue. venue.rb class Venue < ActiveRecord::Base has_and_belongs_to_many :categories end category.rb class Category < ActiveRecord::Base has_and_belongs_to_many :venues end Join Table create_table "categories_venues", id: false, force: true do |t| t.integer