Collection_select with has_one association

Hi,
I try to create a select menu with all the city available in my shop
form. I've been able to populate the select menu but the city_id isn't
stored in the shop table. There must be an error in my view regarding
that i'm not sure to understand each parameters of the
collection_select.

Shop.rb
class Shop < ActiveRecord::Base
  attr_accessible :total_visit, :friends_invited

  has_and_belongs_to_many :products
  has_and_belongs_to_many :owners
  has_many :credits
  has_many :visits
  belongs_to :city
end

City.rb
class City < ActiveRecord::Base
  attr_accessible :name, :continent

  has_one :shop
end

Shop view
<% form_for @shop do |f| %>
  <p>
    <%= collection_select(@shop,:city_id, City.find(:all), :id, :name,
options ={:prompt => "-Select a city"}, :class =>"") %>
  </p>
  <p><%= f.submit "Submit" %></p>
<% end %>

Best,
Greg

Hello,

In your shop view change collection line to: <%=
f.collection_select(:city_id, City.find(:all), :id, :name,
options ={:prompt => "-Select a city"}, :class =>"") %>