Interact with the database from a simple ruby script

Hi,

I have a simple rails application with a model. The data that needs to
be entered in the database comes from an external application which I
can parse using a standard ruby script. What would be the proper way
to handle model/database interactions from an external ruby script?
Should I use rake tasks instead?

Thanks!

JF

Jean-Francois wrote:

Hi,

I have a simple rails application with a model. The data that needs to
be entered in the database comes from an external application which I
can parse using a standard ruby script. What would be the proper way
to handle model/database interactions from an external ruby script?
Should I use rake tasks instead?

Thanks!

JF

Read this:
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial
and maybe this: My Rails Toolbox — err.the_blog

The go ahead and write your rake tasks. :slight_smile:

Emmanuel O.

puts everything togheter, something like:

require ‘rubygems’
require_gem ‘activerecord’

ActiveRecord::Base.establish_connection({
:adapter => ‘mysql’,
:database => ‘mydb’,
:username => ‘user’,
:password => ‘password’
})

class MyTable < ActiveRecord::Base
end

…your ruby script that parse here…

2007/6/19, Jean-Francois [email protected]:

Also check out

http://benlog.org/2007/6/18/stepping-off-the-rails-with-rack