简体   繁体   中英

How to run a CGI Ruby script inside Ruby on Rails?

I'm trying to run a ruby cgi.rb script exactly like this one: http://pine.fm/LearnToProgram/?ShowTutorialCode=true from a Ruby on Rails app in order to obtain a result exactly like this one: http://pine.fm/LearnToProgram/ but inside a Rails Web app.

How can I do it please?

I am not sure, but something like this should be a proper solution (not tested):

match '/that.cgi' => proc { |app| Rack::Handler::CGI.run app }

As Rails uses Rack, it supports mounting it's applications at the router. I'm not sure however about the usage of the Rack::Handler::CGI , it's very poorly documented.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM