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

64 lines
1.6 KiB
Ruby
Raw Normal View History

2012-05-09 18:02:54 -04:00
require 'action_view'
2013-01-31 04:41:52 -05:00
require 'active_model/naming'
2013-01-16 22:17:11 -05:00
require 'active_model/serialization'
2013-01-31 04:41:52 -05:00
require 'active_model/serializers/json'
require 'active_model/serializers/xml'
2013-01-16 22:17:11 -05:00
require 'active_support/inflector'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/name_error'
2012-05-09 18:02:54 -04:00
require 'draper/version'
require 'draper/view_helpers'
require 'draper/delegation'
require 'draper/automatic_delegation'
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'
require 'draper/factory'
2012-11-08 08:06:24 -05:00
require 'draper/decorated_association'
require 'draper/helper_support'
require 'draper/view_context'
require 'draper/collection_decorator'
require 'draper/undecorate'
require 'draper/decorates_assigned'
require 'draper/railtie' if defined?(Rails)
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
extend Draper::DecoratesAssigned
2016-07-04 17:08:25 -04:00
before_action :activate_draper
2012-11-13 15:44:39 -05:00
end
end
def self.setup_action_mailer(base)
base.class_eval do
include Draper::ViewContext
end
end
def self.setup_orm(base)
2012-11-13 15:44:39 -05:00
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
2012-12-02 07:20:42 -05:00
class UninferrableSourceError < NameError
def initialize(klass)
super("Could not infer a source for #{klass}.")
end
end
2012-10-31 20:16:09 -04:00
end