1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00
draper/lib/draper.rb

52 lines
1.3 KiB
Ruby
Raw Normal View History

2012-05-09 18:02:54 -04:00
require 'action_view'
require 'draper/version'
require 'draper/view_helpers'
2012-10-14 18:35:25 -04:00
require 'draper/finders'
2012-10-09 04:51:40 -04:00
require 'draper/decorator'
2012-10-14 18:01:15 -04:00
require 'draper/helper_proxy'
2011-07-13 01:00:10 -04:00
require 'draper/lazy_helpers'
2012-10-09 05:11:57 -04:00
require 'draper/decoratable'
2012-11-08 08:06:24 -05:00
require 'draper/decorated_association'
2012-10-12 05:37:39 -04:00
require 'draper/security'
require 'draper/helper_support'
require 'draper/view_context'
require 'draper/collection_decorator'
require 'draper/railtie' if defined?(Rails)
# Test Support
require 'draper/test/rspec_integration' if defined?(RSpec) and RSpec.respond_to?(:configure)
require 'draper/test/minitest_integration' if defined?(MiniTest::Rails)
require 'draper/test/test_unit_integration'
2012-10-31 20:16:09 -04:00
module Draper
2012-11-13 15:44:39 -05:00
def self.setup_action_controller(base)
base.class_eval do
include Draper::ViewContext
extend Draper::HelperSupport
before_filter ->(controller) {
Draper::ViewContext.current = nil
Draper::ViewContext.current_controller = controller
}
end
end
def self.setup_action_mailer(base)
base.class_eval do
include Draper::ViewContext
end
end
def self.setup_active_record(base)
base.class_eval do
include Draper::Decoratable
end
end
2012-10-31 20:16:09 -04:00
class UninferrableDecoratorError < NameError
def initialize(klass)
super("Could not infer a decorator for #{klass}.")
end
end
end