Problem with a gem: "no such file to load"
I used 'uuidtools' gem in my controller this way:
def create
require 'uuidtools'
game = Game.new
game.permalink = Base64.encode64(UUIDTools::开发者_StackOverflow中文版UUID.random_create)[0..8]
game.save
redirect_to :controller => 'home', :action => 'index'
end
I get this error about the requiring of 'uuidtools':
no such file to load -- uuidtools
(I added the gem to my gem file.)
How can I fix this?
Thanks,
Oded
Perhaps restarting the server would also had fixed the problem
Solved it.
What I did is to migrate the use of 'uuidtools' from the controller to the model:
class Game < ActiveRecord::Base
before_save :create_permalink
def create_permalink
self.permalink = Base64.encode64(UUIDTools::UUID.random_create)[0..8]
end
end
Did you run 'bundle install' to install the gem ?
精彩评论