IO.read fails on relative path in model object


#1

All,

I am attempting to do an IO.read call on a file inside of one of my
model objects.

I keep getting Errno::ENOENT

The path I’m passing to IO.read is relative to RAILS_ROOT.

Two questions:

  1. This code was previously executing in my controller - it it
    significant that I moved it into my model?

  2. Is there some way to verify which directory is the current directory
    for the app.?

Thanks,
Wes


#2

I just verified that I can run this same call in my controller object
without a problem.

Wes G. wrote:

All,

I am attempting to do an IO.read call on a file inside of one of my
model objects.

I keep getting Errno::ENOENT

The path I’m passing to IO.read is relative to RAILS_ROOT.

Two questions:

  1. This code was previously executing in my controller - it it
    significant that I moved it into my model?

  2. Is there some way to verify which directory is the current directory
    for the app.?

Thanks,
Wes


#3

Sorry guys.

Was in the wrong directory. I chdir’ed and never chdir’ed back to where
I thought I was.

Wes G. wrote:

I just verified that I can run this same call in my controller object
without a problem.

Wes G. wrote:

All,

I am attempting to do an IO.read call on a file inside of one of my
model objects.

I keep getting Errno::ENOENT

The path I’m passing to IO.read is relative to RAILS_ROOT.

Two questions:

  1. This code was previously executing in my controller - it it
    significant that I moved it into my model?

  2. Is there some way to verify which directory is the current directory
    for the app.?

Thanks,
Wes