Rails 3 build a select tag with has_many belongs_to association
问题 Based on following models class Company < ActiveRecord::Base belongs_to :country end class Country < ActiveRecord::Base has_many :companies end I want to have in my companies/_form a select tag containing all the countries I think that the Company.new(params[:company]) in companies_controller#create can create the association between company and the selected country I'm running rails 3.0.0, what is the best way to achieve that? thanks for your insights 回答1: collection_select should do the