From: Hemant Bhargava on 28 Apr 2010 05:04 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/.
From: Xavier Noria on 28 Apr 2010 05:28 On Wed, Apr 28, 2010 at 11:04 AM, Hemant Bhargava <hemant.bhargava7(a)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 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.
From: Hemant Bhargava on 28 Apr 2010 05:59 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.. :) -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Date.parse(nil) raises TypeError Next: Adding days to date |