When I try the FasterCSV gem on my application I get this error:
Please switch to Ruby 1.9's standard CSV library. It's FasterCSV plus support for Ruby 1.9's m17n encoding engine.
By the way, I'm using Rails 3, Ruby 1.9.2, and Rubygems 1.4.
Can someone explain to me please how to use the standard CSV library for Ruby 1.9. I don't have any idea at all because I'm very new to Rails.
CSV (comma-separated variables) data is a text representation of a table: A row separator delimits table rows. A common row separator is the newline character "\n" . A column separator delimits fields in a row. A common column separator is the comma character "," .
Ruby 1.9 has adopted FasterCSV as its built-in CSV library. However, it's in the standard library rather than Ruby 1.9's core, so you need to manually require it in your application.
After adding a
require 'csv'
to your code, you can then do things such as
CSV.parse("this,is,my,data")
See Ruby 1.9's standard library CSV documentation for information on using the library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With