0

I run a command:

rake db:migrate RAILS_ENV=test    
ruby service.rb -p 3000 -e test

And I get this error:

, [2013-01-31T10:25:22.197106 #999] DEBUG -- : env: test
service.rb:16:in `<main>': undefined local variable or method `databases' for main:Object (NameError)

I am very new to Rails, can someone brainstorm on what are the things I should be looking at to find the issue? This is from a Tutorial on creating a client app for a Sinatra Rail service with Typheous

EDIT: Here is the link to the service.rb sourcefile that is giving error https://github.com/babakinks/HisFirstService/blob/master/service.rb

4
  • 1
    Please post your code, and be sure to clearly identify which is line 16.
    – jdl
    Jan 31, 2013 at 16:29
  • will do. Just a minute I put on github somewhere...
    – Bohn
    Jan 31, 2013 at 16:32
  • @jdl : Ok here is the link to Service.rb code: github.com/babakinks/HisFirstService/blob/master/service.rb
    – Bohn
    Jan 31, 2013 at 16:37
  • 1
    you should be looking at where databases is defined. you start referencing it on line 16, but it is not defined anywhere. Jan 31, 2013 at 16:45

1 Answer 1

0

like Javid mentioned in the comment I was missing the line to define what is the variable "databases"

Added this:

databases = YAML.load_file("config/database.yml")

Still have some more errors now but as far as this question, that's what was missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.