views:

48

answers:

2

Here is my case:

I want to use a web browser to connect to a Rails application that runs this example code on the server side:

Dir.chdir path_typed_in_by_user
system "ls -la"

I want the output of "ls -la" to be displayed on the web browser.

Is this possible somehow?

A: 

try in a controller:

Dir.chdir path_typed_in_by_user
@out = system `ls -la` # !! look here !! " change `

in a view:

<%= @out %>

Sebastian Brózda
I think you got it wrong. It's system "ls -la". And maybe it's better to put it in a model instead to keep the controllers thin?
never_had_a_name