Raise an error if Rails.root is nil.

This commit is contained in:
Nathan Weizenbaum 2010-05-14 00:20:28 -07:00
parent 7ce70d5334
commit 60926d7e17
3 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,14 @@
* Table of contents
{:toc}
## 3.0.3 (Unreleased)
### Rails 3 Support
In order to make some Rails loading errors easier to debug,
Sass will now raise an error if `Rails.root` is `nil` when Sass is loading.
Previously, this would just cause the paths to be mis-set.
## 3.0.2
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.2).

View File

@ -5,6 +5,12 @@
## 3.0.3 (Unreleased)
### Rails 3 Support
In order to make some Rails loading errors easier to debug,
Sass will now raise an error if `Rails.root` is `nil` when Sass is loading.
Previously, this would just cause the paths to be mis-set.
### Merb Support
Merb, including 1.1.0 as well as earlier versions,

View File

@ -260,7 +260,10 @@ module Haml
#
# @return [String, nil]
def rails_root
return Rails.root.to_s if defined?(Rails.root)
if defined?(Rails.root)
return Rails.root.to_s if Rails.root
raise "ERROR: Rails.root is nil!"
end
return RAILS_ROOT.to_s if defined?(RAILS_ROOT)
return nil
end