title: Rails error: Can't mass-assign protected attributes
body: <p>I am trying to build an extremely simple AddressBook rails application. However, I am getting this error "Can't mass-assign protected attributes: city_id". How can I fix this? Please feel free to add any comment/suggestion to your answer regarding the rails code below. Thanks.</p>
  
  <p>How I created the project (from scratch):</p>
  
  <pre><code>rails new demo
  rails generate model City name:string
  rails generate scaffold User name:string city:references
  rake db:migrate
  </code></pre>
  
  <p>db/seeds.db:  </p>
  
  <pre><code>City.create(name: "City1")
  City.create(name: "City2")
  City.create(name: "City3")
  </code></pre>
  
  <p>rake db:seed</p>
  
  <p>changed this line <code>&lt;%= f.text_field :city %&gt;</code> from <code>app/views/users/_form.html.erb</code> to <code>&lt;%= f.collection_select :city_id, City.all, :id, :name %&gt;</code></p>
  
  <p>changed <code>user.rb</code> auto-generated line <code>belongs_to :city</code> to <code>has_one :city</code>.</p>
  
  <p>added <code>belongs_to :city</code> to <code>city.rb</code></p>
  
  <p>P.S: I am using Rails 3.2.3 and Ruby 1.9.3.</p>