arthur-net arthur-net - 2 months ago 13
Ruby Question

cannot load such file -- smarter_csv (LoadError)

I want to use

smarter_csv
gem, but when I write in my code
require "smarter_csv"
it gives me error message below:


/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- smarter_csv (LoadError)


When i try in irb:

001 > require 'smarter_csv'
=> true


I tried
require "smarter_csv/smarter_csv.rb"
does not help!

How can i fix it?

Answer

I have just tried this gem. It works perfectly fine.

Try:

Step 1 - Install Gem

$ gem install 'smarter_csv'

Step 2 - Create new ruby file test.rb

require 'smarter_csv'

data = SmarterCSV.process('./users.csv')
puts data

Step 3 - Make sure you have your CSV file ready

Step 4 - Run the script

$ ruby test.rb 

Should work just fine