I’m trying to put together a really simple application, which only uses
Rails in the most rudimentary manner.
Basically, I have a command line application that takes one parameter,
and returns the necessary text in return. I also have an existing web
site that can call a URL with a ?param.
What I want to do, is have a simple controller which calls a system(…)
call, passing the ?param to the non-rails application.
I then want the view to display the result. I gather this is bone
simple, and perhaps a little offensive to the spirit of Rails, but what
can I say, baby steps…
call, passing the ?param to the non-rails application.
I then want the view to display the result. I gather this is bone
simple, and perhaps a little offensive to the spirit of Rails, but what
can I say, baby steps…
I suggest you work through some rails tutorials to see how rails works
for typical applications rather than starting with something unusual
(for rails). Then you should see how to do what you want. railstutorial.org is a good free-to-use-online tutorial. Also see the
Rails Guides.
I’m trying to put together a really simple application, which only uses
Rails in the most rudimentary manner.
Hello,
Given the simplicity of what you want to do, you might find it is
better suited to Sinatra, as a very barebones framework.
Rails comes with a lot of baggage and conventions, none of which you
seem to need to use, so it strikes me that you don’t really need
Rails.
But if you want to use Rails, then the description you’ve given
sounds to me like pretty good pseudo-code - just write it up in a
controller action. You will probably want to look at the “backticks”
(I’m not sure what it’s really called) method of calling a system
command (at least, on *nix systems) as this returns the value the OS
returned, rather than “system()” which displays the OS response but
returns true/false:
ls
=>
“app\nconfig\ndb\ndoc\nlib\nlog\npublic\nRakefile\nscript\ntest\ntmp\nvendor\n”
versus:
system(“ls”)
app config db doc lib log public Rakefile script test tmp
vendor
=> true
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.