Reputation: 13
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:
I am still a novice to Rails so I thank you for any suggestions.
Upvotes: 1
Views: 920
Reputation: 16514
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.
Upvotes: 1