I have a watchr script running on my Ruby on Rails 3.1 app and inside the script I need to make a call like: game = Game.find(0)
except whenever the script is being executed I receive this error: uninitialized constant Watchr::Script::EvalContext::Game (NameError)
I'm assuming that I have to require something in the beginning of the script but I'm not sure what. Incase it matters the script is located at /data/xmlwatcher.watchr
Asked
Active
Viewed 54 times
0

Teddy
- 579
- 1
- 4
- 17
1 Answers
0
The best way that I figured out how to do this was to put everything that deals with the database into a rake task and invoke the task with Rake::Task[].invoke. Inside of the Rake task I invoke Rake::Task['environment'] and then it works.

Teddy
- 579
- 1
- 4
- 17