1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Lazy-load ActionView via ActiveSupport.on_load hook

Referencing ActionView::Base constant would kick :action_view load_hooks.
This should better not happen for Rails apps when loading bundled awesome_print gem.
This commit is contained in:
Akira Matsuda 2014-02-15 04:17:18 +09:00 committed by James Cox
parent 63961069bb
commit 60115807e6

View file

@ -25,7 +25,11 @@ unless defined?(AwesomePrint::Inspector)
# #
# Load remaining extensions. # Load remaining extensions.
# #
require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView::Base) if defined?(ActiveSupport)
ActiveSupport.on_load(:action_view) do
require File.dirname(__FILE__) + "/awesome_print/ext/action_view"
end
end
require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper) require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper)
require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid) require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid)
require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri) require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri)