diff --git a/lib/chartkick.rb b/lib/chartkick.rb
index <HASH>..<HASH> 100644
--- a/lib/chartkick.rb
+++ b/lib/chartkick.rb
@@ -5,7 +5,7 @@ require "chartkick/version"
 require "chartkick/engine" if defined?(Rails)
 require "chartkick/sinatra" if defined?(Sinatra)
 
-if defined?(ActiveSupport)
+if defined?(ActiveSupport.on_load)
   ActiveSupport.on_load(:action_view) do
     include Chartkick::Helper
   end
Prevent exception with semi-loaded ActiveSupport. (#<I>)

Certain gems (eg `sinatra/contrib`) load only those parts of

ActiveSupport they require. This leads to `ActiveSupport` being defined,

but other parts (eg the `on_load`) method not.