Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Silenced warnings about RAILS_ROOT

  • Loading branch information...
commit 38793a4e4b7bf00d668141e8acdd2de8cf3240ae 1 parent c7f1409
@solnic authored
Showing with 18 additions and 6 deletions.
  1. +4 −4 lib/dm-paperclip/interpolations.rb
  2. +14 −2 test/helper.rb
View
8 lib/dm-paperclip/interpolations.rb
@@ -54,21 +54,21 @@ def timestamp attachment, style
def web_root attachment, style
if Object.const_defined?('Merb')
merb_root(attachment, style)
- elsif Object.const_defined("RAILS_ROOT")
+ elsif Object.const_defined("Rails")
rails_root(attachment, style)
else
""
end
end
- # Returns the RAILS_ROOT constant.
+ # Returns the Rails.root.to_s constant.
def rails_root attachment, style
- Object.const_defined?('RAILS_ROOT') ? RAILS_ROOT : nil
+ Object.const_defined?('Rails') ? Rails.root.to_s : nil
end
# Returns the RAILS_ENV constant.
def rails_env attachment, style
- Object.const_defined?('RAILS_ENV') ? RAILS_ENV : nil
+ Object.const_defined?('Rails') ? Rails.env : nil
end
def merb_root attachment, style
View
16 test/helper.rb
@@ -13,8 +13,20 @@
puts "ruby-debug not loaded"
end
-ROOT = File.join(File.dirname(__FILE__), '..')
-RAILS_ROOT = ROOT
+ROOT = File.join(File.dirname(__FILE__), '..')
+
+module Rails
+ class << self
+ def root
+ ROOT
+ end
+
+ def env
+ "test"
+ end
+ end
+end
+
RAILS_ENV = ENV['RAILS_ENV']
Object.const_set("Merb", Class.new())
Please sign in to comment.
Something went wrong with that request. Please try again.