How to output a list of category names ?

~MODEL~ ../contract.rb class Contract < ActiveRecord::Base has_and_belongs_to_many :places end

../place.rb class Place < ActiveRecord::Base   has_and_belongs_to_many :contracts end

../schema.rb   create_table "contracts", :force => true do |t|      . . .        t.string "place"      . . .   end

  create_table "contracts_places", :id => false, :force => true do |t|        t.integer "contract_id"        t.integer "place_id"   end

  create_table "places", :force => true do |t|        t.string "name"        t.datetime "created_at"        t.datetime "updated_at"   end

                                             ~CONTROLLER~

../contracts_controller.rb   def show # (edit)     @contract = Contract.find(params[:id])      @places = @contract.places   end

                                             ~VIEW~ ../_contract.html.erb <%= @places.names %> # Does't work

@places.map(&:name)

will give you an array of names which you can format as you wish.

HTH,

Thanks for help. It works fine!