Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails.public_path should be a pathname (includes pseudo-patch)

#4327

Thanks to rails/railties/lib/rails/engine/configuration.rb we know that Rails.root will always be either nil or a Pathname since application.config.root will always be either nil or a Pathname.

Therefore we can change Rails.public_path (rails/railties/lib/rails.rb) to be defined as follows:

def public_path
  @@public_path ||= self.root ? self.root.join("public") : Pathname.new("public")
end
def public_path=(path)
  @@public_path = Pathname.new(path)
end

The rails.rb file aready requires pathname, so this is no new dependency.

Since this is a near trivial change, and I don't happen to have a handy Edge rails checkout, I've not included the changes in standard patch format, but the code above is exactly the desired end result modulo whitespace. I of course have not tested this, but that should be trivial for anybody with an edge rails checkout.

Hope this helps improve Rails. :D

Reported by Jsmith45 · April 5th, 2010 @ 06:58 AM

State: duplicate
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Andrew White
  2. Jsmith45
    Jsmith45

    Correct. Would somebody please close as a duplicate?

    April 5th, 2010 @ 05:26 PM

  3. Rizwan Reza
    Rizwan Reza
    • State changed from new to duplicate

    April 5th, 2010 @ 09:20 PM

  4. Ryan Bigg
    Ryan Bigg
    • Importance changed from to Low

    Automatic cleanup of spam.

    October 11th, 2010 @ 10:53 AM