diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb index eb61a7fc22c9d..e03a74425755d 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 8af7b5e565e51..38c8685390c18 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 @@ def parse(data) end end end -end \ No newline at end of file +end