This project is archived and is in readonly mode.

#4327 ✓duplicate

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

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

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") :"public")
def public_path=(path)
  @@public_path =

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket