Kfir Lavi
2006-Apr-15 15:24 UTC
[Rails] Model isn''t in the scope when running script/console
Hi, When running the script/console I can''t run the model. Example: I have model Probe. So, running: Probe.class will not work, because Probe is not loaded. I tried to build some projects from scratch automatically generated, but the problem stays. Any thoughts? Thanks, Kfir
Francois GORET
2006-Apr-15 15:36 UTC
[Rails] Model isn''t in the scope when running script/console
On Saturday 15 April 2006 22:24, Kfir Lavi wrote:> Hi, > When running the script/console I can''t run the model. > Example: > I have model Probe. > So, running: > Probe.class will not work, because Probe is not loaded.I think that ActiveRecord loads the models on demand only. So when you try to access the "Probe" class, the system will fetch the file named app/models/probe.rb from the root of your rails application. Francois
Craig White
2006-Apr-15 15:37 UTC
[Rails] Model isn''t in the scope when running script/console
On Sat, 2006-04-15 at 15:24 +0000, Kfir Lavi wrote:> Hi, > When running the script/console I can''t run the model. > Example: > I have model Probe. > So, running: > Probe.class will not work, because Probe is not loaded. > > I tried to build some projects from scratch automatically generated, > but the problem stays. > Any thoughts?---- try entering this in console... require "app/models/probe.rb" Craig