Uninitialized constant ActiveRecord (NameError)

Hi All,

I am running a script from console line with command as ruby
script/abc.rb. But i am getting error “uninitialized constant
ActiveRecord (NameError)”. Why so … ?
My first line of the script is class-

CronJobs < ActiveRecord::Base


end

On Wed, Apr 28, 2010 at 11:04 AM, Hemant B.
[email protected] wrote:

I am running a script from console line with command as ruby
script/abc.rb. But i am getting error “uninitialized constant
ActiveRecord (NameError)”. Why so … ?
My first line of the script is class-

CronJobs < ActiveRecord::Base


end

If that script belongs to a Rails application run it with script/runner
instead:

script/runner script/abc.rb

On the other hand, if you are using Active Record stand-alone then you
need to load it as any other library.

Xavier N. wrote:

If that script belongs to a Rails application run it with script/runner
instead:

script/runner script/abc.rb

On the other hand, if you are using Active Record stand-alone then you
need to load it as any other library.

O O… yeah yeah. This is the correct way. Thanks for your time… :slight_smile: