I have a script in the MyApp/script directory which is run via cron to periodically retrieve information from an as400 system. Currently it uses DBI odbc and DBI mysql and is completely standalone. It reads the information from the as400 and insert it into the application''s local mysql database. Since it doesn''t tie into AR, all the SQL is hardcoded and the script has to massage the data to get it into the proper tables. If I could use AR and my exisiting models, it would make it much easier to manage. I''d like to know if it''s possible to use my application AR models in this script (only for the mysql side, not the as400) and if so, how I might go about requiring/including them in the above script. Thanks. Chris
> I''d like to know if it''s possible to use my application AR models in > this script (only for the mysql side, not the as400) and if so, how I > might go about requiring/including them in the above script.Look at script/runner. It''s the new thing kids are doing. I do believe common usage is like this: script/runner "BlahService.blah_blah()" http://wiki.rubyonrails.com/rails/pages/Environments/ Or, just include environment.rb. -- rick http://techno-weenie.net
Rick, Thanks for the input. Including environment.rb looks like the way to go. Chris On 10/20/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''d like to know if it''s possible to use my application AR models in > > this script (only for the mysql side, not the as400) and if so, how I > > might go about requiring/including them in the above script. > > Look at script/runner. It''s the new thing kids are doing. I do > believe common usage is like this: > > script/runner "BlahService.blah_blah()" > > http://wiki.rubyonrails.com/rails/pages/Environments/ > > Or, just include environment.rb. > > -- > rick > http://techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >