2

I used 'uuidtools' gem in my controller this way:

 def create require 'uuidtools' game = Game.new game.permalink = Base64.encode64(UUIDTools::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

1
  • I have just installed uuidtools and tested it in my rails console. Can you do UUIDTools::UUID.random_create in your rails console? Commented Apr 16, 2011 at 20:19

3 Answers 3

5

Perhaps restarting the server would also had fixed the problem

Sign up to request clarification or add additional context in comments.

1 Comment

Restarting webrick after the bundle install fixes it every time.
1

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 

1 Comment

emmm no. and the moving method to the model is better than leaving it in the controller (basic stuff you should know...)
0

Did you run 'bundle install' to install the gem ?

6 Comments

are you sure that you need to require 'uuidtools' ? Does it work if you remove this line ?
I think yes because if I dont require I get this error: "uninitialized constant GamesController::UUIDTools"
What I did is based on an answer from this question: stackoverflow.com/questions/3165784/…
try to use "include GamesController::UUIDTools" instead.
or just 'include GamesController'
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.