Model isn't in the scope when running script/console


#1

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


#2

On Saturday 15 April 2006 22:24, Kfir L. 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


#3

On Sat, 2006-04-15 at 15:24 +0000, Kfir L. 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