How to use ActiveRecord plugins outside of Rails framework?

Hey Guys,

I’ve got an acts_as_list association in one of my models. When I
attempt to load this file outside of Rails… ie: when I invoke my
script via:

ruby -S -I $RAILS_ROOT/app/models myscript.rb

I get the following error message:

/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
method_missing': undefined methodacts_as_list’ for
#Class:0xb7b06924 (NoMethodError)
from /home/sonnychee/projects/ngs/app/models/task_prereq.rb:30

How do I get the acts_as_list method defintion loaded up? There are
also a bunch of other plugins that I require in the vendor/plugins
folder…

Any pointers would be appreciated.

Sonny.

Any pointers would be appreciated.

Sonny.

This is what script/runner is for. Or do you want to avoid that?

Stephan

Check the ‘init.rb’ of each of the plugins. Whatever they do
(typically a require along with ARec.send(:include, somthing)) you
need to do as well.

On Feb 20, 8:37 pm, Sonny C. [email protected]

AndyV wrote:

Check the ‘init.rb’ of each of the plugins. Whatever they do
(typically a require along with ARec.send(:include, somthing)) you
need to do as well.

Thanks Andy. Good for future reference.

Stephan W. wrote:

This is what script/runner is for.

Awesome, thanks Stephan. This is exactly what I was looking for.

Sonny.