SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot HenriIV's Avatar
    Join Date
    Jun 2004
    Location
    France
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RAILS_ROOT Problem (a different one)

    Hi,

    Why RAILS_ROOT returns a relative path instead of a complete one?
    I thought I could use RAILS_ROOT but with something like ./script/../config/.. instead of c:/ruby/rails/project1/ it's unusable

  2. #2
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where are you looking to use RAILS_ROOT?

    I hate to say it but Dir.pwd might return what you want.

  3. #3
    SitePoint Zealot HenriIV's Avatar
    Join Date
    Jun 2004
    Location
    France
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't use Dir.pwd, I just want to get the root directory of my app, to do something like

    UPLOAD_DIR = 'public/images/upload'

    and add build the complete filesystem path with
    complete_path = "#{RAILS_ROOT}/#{UPLOAD_DIR}"

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps I'm missing something, but if you reference a directory from a controller, model, whatever without a slash in the front it starts from your Rails application's root directory.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •