Reputation: 51
I am new to Ruby and Rails so this question might be trivial, but
How can you include/use a gem in Rails?
Do you just put "gem '
What do you do after that?
If this procedure is correct, when I try to run 'rails server' it spits out this error
/.rvm/gems/ruby-1.9.2-p0@global/gems/gdata-1.1.1/lib/gdata.rb:21:in `require': no such file to load -- jcode (LoadError)
What am I doing wrong?
Ruby 1.9.2 Rails 3 RubyGem 1.3.7 Gem i'm trying to use 'contacts' 1.2.4
Thanks guys, Sean Chan
Upvotes: 5
Views: 5944
Reputation: 330
I had the same problem. Updated to ruby 1.9.2 and the problem stopped.
Upvotes: 0
Reputation: 15181
I had the same issue, here is how I fixed it:
In case you havent already, put gem 'contacts'
in your Gemfile
and run
bundle install
Ruby >= 1.9 doesn't have jcode, a module to handle japanese (EUC/SJIS) strings, as it supports unicode natively.
So you will need to add: require 'jcode' if RUBY_VERSION < '1.9'
to your gdata gem
found under your .rvm
directory somewhere similar to this:
/home/.rvm/gems/ruby-1.9.2-p0@your_gemset_name/gems/gdata-1.1.1/lib/gdata.rb
change line 21
to:
if RUBY_VERSION < '1.9'
require 'jcode'
$KCODE = 'UTF8'
end
As I'm also a noob how would I go about letting the author of the gdata gem know about this?
Upvotes: 10
Reputation: 176352
To use a Gem in Rails 3 you need to specify it in the Gemfile
and use bundler to install the dependency. Here's a few resources to learn more about Bundler and Rails 3
Upvotes: 8