I would like to know how I can run a file.rb directly into controller. For example, I have followed the tuto for Twilio, and it's working using the command : "ruby test.rb" into terminal to run the file test.rb into the app folder.
But I don't know how I can run this file directly into my controller. For example :
TestController.rb
def test_sms
run "test.rb"
end
end
UPDATE
According to @Seth answer, the good solution looks like that.
My file :
class Test
attr_accessor :body
def initialize
# ...
end
def do_something
self.body = "Test string params"
end
end
And my controller :
require "path/to/file"
class TestController < ApplicationController
def test_sms
test = Test.new
test.do_something
body = test.body
print body
end
end