Issuing Ruby Commands from Rails?


I have an application where I would like to issue Ruby commands from a
Rails application and pipe the resulting stuff from the command line
into a Rails variable.

Does anyone have a good way to do this?


Call to Ruby Program:

ruby callFunction.rb some_params ( where 'some_params' is given from a form in the Rails app)

Results Returned:

result - answer1
result - answer2

Ideally then I could have these results stored in a variable to put in
my view.

Thanks, let me know if this is not clear!

At what point does the command get issued? When the view is rendered?

I'm assuming this would work for Windows environment too?


I tried this out an when the view is rendered, all I get is what
@result was.

So in the example below, my view displays this:

Result: `cd /Users/rails/Desktop/;ls`

Pete, check that you're using backticks (and not single-quotes) in
your code above.

- BD