Cmd. line scripts that use Rails?

Hi all,

I would like to use the Rails framework through scripts. Some of us
like using browsers as an interface, but many of us prefer the command
line.

Does anyone know about writing Ruby scripts that can make use of the
Rails framework to access the database, all from the command line?

Thanks,

  • Derek

It’s pretty much built-in. Just use script/console.

-Jonathan

Thanks, but I think I need to explain myself better. For example, I
want to write a script, executable from the command line, that takes
options from the user and performs the necessary database functions
through Rails.

If I want to edit a LineItem, let’s say, then this command line script
would not be responsible for handling locking, validation, counts,
relationships, etc. Instead, I want to have the Rails code do it.

Is this the sort of thing to which you were referring?

  • Derek

Great, thanks!

You can use script/runner to execute a rails comand.

-Jonathan.

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