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

···

--
Posted via http://www.ruby-forum.com/.

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.

···

On Wed, Apr 28, 2010 at 11:04 AM, Hemant Bhargava <hemant.bhargava7@gmail.com> 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

Xavier Noria 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:

···

--
Posted via http://www.ruby-forum.com/\.