This project is archived and is in readonly mode.
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") : 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
Comments and changes to this ticket
-
Rizwan Reza April 5th, 2010 @ 09:20 PM
- State changed from new to duplicate
-
Ryan Bigg October 11th, 2010 @ 10:53 AM
- Importance changed from to Low
Automatic cleanup of spam.
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>