title: when to use attributes hash
body: <p>In this SO answer <a href="https://stackoverflow.com/questions/1815697/undefined-method-stringify-keys-ruby-on-rails">undefined method `stringify_keys!&#39; ruby on rails</a>, the OP tried to create a new car object with a  'Honda' string to the </p>
  
  <pre><code> @car = Car.new(params[:car])
  </code></pre>
  
  <p>and got a stringify keys error. The person who answered said that he had to specify the column from the table (in this case the 'name' column) when creating the object ,</p>
  
  <pre><code>create expects to get an attributes hash and to stringify it's keys for the column names.
  
  If you have a column named name in your cars table then try this:
  
  @car = Car.new(:name =&gt; params[:car])
  </code></pre>
  
  <p>However, I'm watching a RailsCast where Rbates creates an entry table with 'name' string and a column 'winner' as a boolean. In his controller (which he's set to respond with json), he does not use an attributes hash. His create action</p>
  
  <pre><code>   def create
       respond_with Entry.create(params[:entry])
     end
  </code></pre>
  
  <p>Why didn't Rbates have to use an attributes hash, and, if he could have, what would that attributes hash look like? Something like this? Do you have to name every column, in ryans case :name and :winner?</p>
  
  <pre><code>   def create
       respond_with Entry.create(:name =&gt; params[:entry][:name], :winner =&gt; params[:entry]     [:winner]
     end
  </code></pre>