diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-16 11:56:51 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-16 11:56:51 -0600 |
commit | 7ee5843c3cedfe36a680d5b28aa31eef45296c50 (patch) | |
tree | d399cb71b2533ec353ebbb5cc19a0c0902da1987 /activemodel | |
parent | 1ab35020c152575c84d4ca95842d55be307e1fee (diff) | |
download | rails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.tar.gz rails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.tar.bz2 rails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.zip |
Fully expand relative rails framework paths and make sure we aren't
adding any to the load path more than once.
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model.rb | 5 | ||||
-rw-r--r-- | activemodel/test/cases/helper.rb | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb index 8e14b6724f..e0de27b96d 100644 --- a/activemodel/lib/active_model.rb +++ b/activemodel/lib/active_model.rb @@ -21,10 +21,11 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" -$:.unshift(activesupport_path) if File.directory?(activesupport_path) +activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__) +$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path) require 'active_support' + module ActiveModel extend ActiveSupport::Autoload diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index 024f2378be..30193956ea 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -1,11 +1,9 @@ -root = File.expand_path('../../../..', __FILE__) begin - require "#{root}/vendor/gems/environment" + require File.expand_path('../../../../vendor/gems/environment', __FILE__) rescue LoadError - $:.unshift("#{root}/activesupport/lib") end -lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib") +lib = File.expand_path('../../../lib', __FILE__) $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) require 'config' |