require 'csv'
csv_text = File.read('...')
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
Moulding.create!(row.to_hash)
end
More Related Contents:
- in rails, how to return records as a csv file
- How do I remove lines of data in the middle of a text file with Ruby
- How to show SQL queries run in the Rails console?
- Can’t stop rails server
- How to set request headers in rspec request spec?
- Rails – link_to helper with data-* attribute [duplicate]
- Protected and private methods in Rails
- Failed to build gem native extension — Rails install
- Rails: Preserving GET query string parameters in link_to
- ActionMailer not sending mail in development Rails 4
- How to use the I18n fallback features in Rails 3
- Rails: Overriding ActiveRecord association method
- Is it bad to change _id type in MongoDB to integer?
- Rails – render :action to target anchor tag?
- Changing the default date and time format in Rails 4
- Import CSV to Update rows in table
- Can you Distribute a Ruby on Rails Application without Source?
- What is MVC in Ruby on Rails?
- Is there a “phpmyadmin” for Ruby on Rails? [closed]
- How do I avoid a race condition in my Rails app?
- Force SSL using ssl_requirement in Rails 2 app
- Is it thread safe to set Active Resource HTTP authentication on a per-user basis?
- Rails 2 to Rails 3 : using link_to instead of link_to_remote (including remote and update)
- heroku – Missing required arguments: aws_access_key_id, aws_secret_access_key, following Hartl tutorial
- Rails Model has_many with multiple foreign_keys
- Rails 4.0 with Devise. Nested attributes Unpermited parameters
- Specifying column name in a “references” migration
- Rails App Not Serving Assets in Production Environment
- Ruby 1.9.2 and Rails 3 cannot open rails console
- Rails action caching with querystring parameters