From ab321268f86d9013cbd4ecd0b5f46e7b05ec55a9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 16:10:49 -0700 Subject: No more free lunch --- activemodel/lib/active_model/core.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/core.rb b/activemodel/lib/active_model/core.rb index 47b968e121..6b2bee53d9 100644 --- a/activemodel/lib/active_model/core.rb +++ b/activemodel/lib/active_model/core.rb @@ -1,7 +1,12 @@ -# This file is required by each major ActiveModel component for the core requirements. This allows you to -# load individual pieces of ActiveModel as needed. -$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', '..', 'activesupport', 'lib') +begin + require 'active_support' +rescue LoadError + activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" + if File.directory?(activesupport_path) + $:.unshift activesupport_path + require 'active_support' + end +end -# premature optimization? # So far, we only need the string inflections and not the rest of ActiveSupport. -require 'active_support/inflector' \ No newline at end of file +require 'active_support/inflector' -- cgit v1.2.3 From b2d6fdae353be4fca41d7ac1839f30d9737162fd Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 17:00:33 -0700 Subject: Fix tests on 1.9 --- activemodel/lib/active_model/core.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/core.rb b/activemodel/lib/active_model/core.rb index 6b2bee53d9..b4b020defc 100644 --- a/activemodel/lib/active_model/core.rb +++ b/activemodel/lib/active_model/core.rb @@ -1,7 +1,7 @@ begin require 'active_support' rescue LoadError - activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" + activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib" if File.directory?(activesupport_path) $:.unshift activesupport_path require 'active_support' -- cgit v1.2.3 From 2f42433f0a9d777e2a8f5fa05370ba464823933c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 5 May 2009 21:40:53 -0700 Subject: Cherry-pick the inflector only --- activemodel/lib/active_model/core.rb | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/core.rb b/activemodel/lib/active_model/core.rb index b4b020defc..4201bcf158 100644 --- a/activemodel/lib/active_model/core.rb +++ b/activemodel/lib/active_model/core.rb @@ -1,12 +1,3 @@ -begin - require 'active_support' -rescue LoadError - activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib" - if File.directory?(activesupport_path) - $:.unshift activesupport_path - require 'active_support' - end -end - -# So far, we only need the string inflections and not the rest of ActiveSupport. +activesupport_path = "#{File.dirname(__FILE__)}/../../../activesupport/lib" +$:.unshift(activesupport_path) if File.directory?(activesupport_path) require 'active_support/inflector' -- cgit v1.2.3