I made a script in ruby and now I need to run it in a rails application. I’m a little lost, but I have a controller, and wanted through a GET /service /:id returns the result of this script. How can I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By the comments, it seems like you want to make this into a method you can call from your controller.
Simple.
Define the method in the corresponding Model for the Controller you’re calling it from (or whatever Model you wish to define the method in) and then call it from the Controller.
Say you have a ScriptRunner model, and you want to call this from the show action of some controller.
In your ScriptRunner model, simply do
and in your controller, do
..or whatever you want it to do.