Booting rails

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…

On May 7, 12:20 am, slava [email protected] 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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs