1

I have a very basic website where a user inputs text to a text field form and submits this text. The text then is supposed to be a parameter for a Ruby script, which will in turn return data based on this supplied text.

My questions:

  1. Can you execute a Ruby script from a Controller?
  2. If yes, what if this Ruby script takes a few minutes until it returns data? Delayed job?
  3. Instead of running a Ruby script, can I import the function from this Ruby script into my controller?

I am still a novice to Rails so I thank you for any suggestions.

1
  • 1. Yes. 2. delayed_job (or its alternatives) is a good idea. 3. Yes. Commented Dec 19, 2014 at 10:20

1 Answer 1

1

Can you execute a Ruby script from a Controller?

Yes you can, fa the scripts is external, like:

system('script.rb')

But of course the better way is to embed the script into the Rails app.

If yes, what if this Ruby script takes a few minutes until it returns data? Delayed job?

Of course Delayed Job, see here on how to do that.

Instead of running a Ruby script, can I import the function from this Ruby script into my controller?

Of course yes, and that way is preferrable, but anyway if that is available to implement.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.