title: How to convert a string "560,000" into an integer 560000 when importing from csv into database in Rails
body: <p>just started learning Rails and have managed to import a csv file into a database, but the price field in the csv has quotes and a comma like this: "560,000"  </p>
  
  <p>But if I make the price field as t.integer in the migration file, then add the data, the price gets imported as 560.  So, how do I remove the quotes and the comma before importing it? thanks, Adam</p>
  
  <p>edit: here's the rake file:</p>
  
  <pre><code>require 'csv'    
  
  task :csv_to_properties =&gt; [:environment] do 
    CSV.foreach("lib/assets/cbmb_sale.csv", :headers =&gt; true) do |row|
  
      Property.create!(row.to_hash)
    end
  end
  </code></pre>