On Fri, Sep 19, 2008 at 1:03 PM, Nick da G <nick.gorbikoff / gmail.com> wrote:
> Hi, All.
>
> I'm writing a script that's going to run on schedule to pull some info
> from a db and dump it into a csv to be ftped
>
> And a similar script to process a csv/excel file we get from a vendor to
> put in our db.
>
> I can use like Ruby DBI or something.
> But I'd much rather use ActiveRecord. Here is the question.
>
> How do I let my ruby script know to include all of my rails goodies.
> Like the Model's I already created?
>
> I tried to write a sample where I connect to a db using activerecord and
> it works, but it looks like I will have to recreate all of my models in
> my Ruby script? Which is not a biggie - jsut copy and paste, but I'd
> hate to maintain 2 versions of models.
>
> Also will I run into any problems with my restfull_authentication plugin
> doing that if it is possible to do at all (this might be a question for
> a Rails list thou)

You might be able to simple load them (load '/dir_path/my_model.rb').
You can simply get a list of the Model file names, and iterate through
them, loading each one.  I've tested Models in irb like that.  YMMV.

Todd