aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/lib/active_support/xml_mini/nokogiri.rb7
-rw-r--r--activesupport/lib/active_support/xml_mini/nokogirisax.rb9
2 files changed, 13 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb
index eb61a7fc22..e03a744257 100644
--- a/activesupport/lib/active_support/xml_mini/nokogiri.rb
+++ b/activesupport/lib/active_support/xml_mini/nokogiri.rb
@@ -1,4 +1,9 @@
-require 'nokogiri'
+begin
+ require 'nokogiri'
+rescue LoadError => e
+ $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
require 'active_support/core_ext/object/blank'
# = XmlMini Nokogiri implementation
diff --git a/activesupport/lib/active_support/xml_mini/nokogirisax.rb b/activesupport/lib/active_support/xml_mini/nokogirisax.rb
index 8af7b5e565..38c8685390 100644
--- a/activesupport/lib/active_support/xml_mini/nokogirisax.rb
+++ b/activesupport/lib/active_support/xml_mini/nokogirisax.rb
@@ -1,4 +1,9 @@
-require 'nokogiri'
+begin
+ require 'nokogiri'
+rescue LoadError => e
+ $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
require 'active_support/core_ext/object/blank'
# = XmlMini Nokogiri implementation using a SAX-based parser
@@ -80,4 +85,4 @@ module ActiveSupport
end
end
end
-end \ No newline at end of file
+end