I am new to Rails, and am doing a simple db import but cannot resolve an error.
I have data like so in a CSV:
"Symbol","Name","LastSale","MarketCap","IPOyear","Sector","industry","Summary Quote",
"DDD","3D Systems Corporation","12.95","$1.45B","n/a","Technology","Computer Software: Prepackaged Software","http://www.nasdaq.com/symbol/ddd",
I create a model for the entries with the following command:
bin/rails generate model Companies Symbol:string Name:string LastSale:string MarketCap:string IPOyear:string Sector:string Industry:string SummaryQuote:string
...I run db:migrate, and then try to import the data to the model with this rake task:
task :populate => :environment do
#http://stackoverflow.com/questions/4410794/ruby-on-rails-import-data-from-a-csv-file
CSV.foreach("companylist.csv", :headers => true) do |row|
Company.create!(row.to_hash)
end
end
This results in an error:
rake aborted!
ActiveRecord::UnknownAttributeError: unknown attribute 'industry' for Company.
However, the "Company" model was created with an Industry atrribute--I am not sure how to proceed.
Thank you for the help!