Forum: Ruby on Rails booting rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C21ccd7a22dc14980e3cc9cb5cf2dcef?d=identicon&s=25 slava (Guest)
on 2009-05-07 01:21
(Received via mailing list)
I need to use an activerecord model in a ruby script that is run from
outside rails, so I need to boot rails from my script, otherwise I
get
uninitialized constant ActiveRecord
I tried adding
require 'config/boot'
to the script to boot rails before running the script, but that did
not help..
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-07 01:28
(Received via mailing list)
On May 7, 12:20 am, slava <slava_mike...@yahoo.com> wrote:
> I need to use an activerecord model in a ruby script that is run from
> outside rails, so I need to boot rails from my script, otherwise I
> get
> uninitialized constant ActiveRecord
> I tried adding
> require 'config/boot'
> to the script to boot rails before running the script, but that did
> not help..

To load the full rails environment you need to require config/
environment   (you might want to investigate script/runner)

Fred
This topic is locked and can not be replied to.