"no such file to load -- fastercsv" error when trying to use fastercsv gem
I installed the fastercsv gem like this:
sudo gem install fastercsv
Then in my controller I put this:
require 'fastercsv'
When I try to use it though, I get this error:
MissingSourceFile in Notes#export_data
no such file to load -- fastercsv
What have I done开发者_如何学Go wrong? Thanks for reading.
EDIT: I'm using Rails 2.3.5
rake gems
(in /Users/bh/rails_projects/notes)
- [I] authlogic
- [R] activesupport
- [I] searchlogic
- [R] activerecord >= 2.0.0
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
-
gem which fastercsv
/usr/local/lib/ruby/gems/1.8/gems/fastercsv-1.5.3/lib/fastercsv.rb
You should add it to your config/environment.rb
config.gem "fastercsv"
You'll see a few other lines mentioning config.gem
, so stick it next to those. You might have to add :version => 'x.x.x'
, if you have multiple versions of fastercsv and want to use a specific one.
You only need to add the following line in the GemFile
gem 'fastercsv'
After doing that, remember to reboot your server application.
What version of Rails are you using?
If it's Rails 3 you'll need to specify it as a dependency of your application in the Gemfile:
gem 'fastercsv'
精彩评论