Natalia Natalia - 1 year ago 100
Ruby Question

Where is the CSV gem in Rails?

I’m using Rails 4.2 with Ruby 2.3.0. I want to use the CSV parsing library, which according to the documentation is part of the core Ruby distribution — . However, when I put this on my page

csv = CSV.parse(text_content, :headers => true)

it results in this error

Error during processing: uninitialized constant CsvToActivityConverterService::CSV

Do I need another gem to include the CSV library in my Rails project?

Answer Source

You need to require 'csv' to use it!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download