rubycookbook 15.1 problem

R

rajibsukanta

I was following along Lucas's rubycookbook receipe 15.1 for creating a
ROR application for displaying the o/p of dir command on a windows
machine onoto a browser.

my application is named "check" instead of "status" as given in
receipe.

my C:/Documents and
Settings/ri004902/check/app/controllers/check_controller.rb .. file
looks as
.........................................................
class CheckController < ApplicationController
def index
time = Time.now
@time = time
@dr = exec "dir/p"
end
end
.......................................
and my C:\Documents and
Settings\ri004902\check\app\views\check\index.rhtml .. file is
................................................................
<h1>Directory structure at <%= @time %></h1>
<p><%= @dr %></p>
......................................................

I start the webbrick and point my brwser to
http://localhost:3000/check/

what i get is
Application error (Rails)

I tried with @dr= 'dir/p' in index of CheckController .. but in vain.

could anyone provide me a lead.



Cheers
Rajib
 
M

matt neuburg

I was following along Lucas's rubycookbook receipe 15.1 for creating a
ROR application for displaying the o/p of dir command on a windows
machine onoto a browser.

my application is named "check" instead of "status" as given in
receipe.

my C:/Documents and
Settings/ri004902/check/app/controllers/check_controller.rb .. file
looks as
........................................................
class CheckController < ApplicationController
def index
time = Time.now
@time = time
@dr = exec "dir/p"
end
end
......................................
and my C:\Documents and
Settings\ri004902\check\app\views\check\index.rhtml .. file is
...............................................................
<h1>Directory structure at <%= @time %></h1>
<p><%= @dr %></p>
.....................................................

I start the webbrick and point my brwser to
http://localhost:3000/check/

what i get is
Application error (Rails)

I tried with @dr= 'dir/p' in index of CheckController .. but in vain.

could anyone provide me a lead.

This could be irrelevant - I'm on Mac OS X, and there is no "dir"
command there - but OMM the example as printed doesn't work either,
because the single-quotes in the original should be backticks. The
recipe has:

@ps = 'ps aux'

But it should be:

@ps = `ps aux`

Perhaps you should try `dir/p` (whatever that may be) instead of using
exec? Just a guess... m.
 
R

rajibsukanta

command there - but OMM the example as printed doesn't work either,
because the single-quotes in the original should be backticks. The
recipe has:

@ps = 'ps aux'

But it should be:

@ps = `ps aux`

Perhaps you should try `dir/p` (whatever that may be) instead of using
exec? Just a guess... m.

Oh .. i thought that was right..now i tried with

class CheckController < ApplicationController
def index
time = Time.now
@time = time
@dr = ` dir `
end
end

.... but in vain still that " Application error (Rails)" is bugging me.

any lead?

btw .. what is the best way to debug rails application

thanks
rajib
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,219
Messages
2,571,117
Members
47,730
Latest member
scavoli

Latest Threads

Top