From 1f2a4b37accc023c96148d54d8daa3a751446c44 Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion" Date: Thu, 1 May 2008 20:47:09 +0200 Subject: Prevent AssetTagHelper from crashing if RAILS_ROOT is not defined. Fixes compatibility with Passenger. [#84 state:resolved] Signed-off-by: Jeremy Kemper --- railties/lib/initializer.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index ea61d4e4fe..09a98d5aa3 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -28,7 +28,11 @@ module Rails end def root - RAILS_ROOT + if defined?(RAILS_ROOT) + RAILS_ROOT + else + nil + end end def env @@ -40,7 +44,7 @@ module Rails end def public_path - @@public_path ||= File.join(self.root, "public") + @@public_path ||= self.root ? File.join(self.root, "public") : "public" end def public_path=(path) -- cgit v1.2.3