# Booting rails

**URL:** <https://www.ruby-forum.com/t/booting-rails/167359>\
**Category:** Rails\
**Created:** [May 7, 2009, 1:21am UTC](https://www.ruby-forum.com/t/booting-rails/167359 "2009-05-07T01:21:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![slava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@slava](https://www.ruby-forum.com/u/slava)\
**Post date:** [May 7, 2009, 1:21am UTC](https://www.ruby-forum.com/t/booting-rails/167359/1 "2009-05-07T01:21:40Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![slava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b487fb/32.png) [@slava](https://www.ruby-forum.com/u/slava)\
**Post date:** [May 7, 2009, 1:28am UTC](https://www.ruby-forum.com/t/booting-rails/167359/2 "2009-05-07T01:28:06Z")

</div>

On May 7, 12:20 am, slava [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
