From 8a6d59df81d55fa5a7d7fa5bb545a577d86ad13f Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Thu, 18 Feb 2010 08:21:33 +0000 Subject: [PATCH] Rails.public_path is now deprecated and Rails.public returns a Pathname for easy joining and to be similar to Rails.root --- railties/lib/rails.rb | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 3d3151b..c5e27be 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -85,11 +85,23 @@ module Rails end def public_path - @@public_path ||= self.root ? File.join(self.root, "public") : "public" + ActiveSupport::Deprecation.warn "Rails.public_path is deprecated, " << + "please use Rails.public instead", caller + @@public ||= self.root ? File.join(self.root, "public") : "public" end def public_path=(path) - @@public_path = path + ActiveSupport::Deprecation.warn "Rails.public_path= is deprecated, " << + "please use Rails.public= instead", caller + @@public = path + end + + def public + @@public ||= Pathname(self.root ? File.join(self.root, "public") : "public") + end + + def public=(path) + @@public = path end end end -- 1.7.0