uninitialized constant ActiveRecord (NameError)

H

Hemant Bhargava

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
 
X

Xavier Noria

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.
 
H

Hemant Bhargava

Xavier said:
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.. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top