Sha256: eeeb9d040db500d44f25be703c5be3d9a16a6f555fa9a54ef2582ec53dbf5b33
Contents?: true
Size: 696 Bytes
Versions: 2
Compression:
Stored size: 696 Bytes
Contents
require_relative 'query_methods/load_strategy' module Draper module QueryMethods # Proxies missing query methods to the source class if the strategy allows. def method_missing(method, *args, &block) return super unless strategy.allowed? method object.send(method, *args, &block).decorate(with: decorator_class, context: context) end def respond_to_missing?(method, include_private = false) strategy.allowed?(method) || super end private # Configures the strategy used to proxy the query methods, which defaults to `:active_record`. def strategy @strategy ||= LoadStrategy.new(Draper.default_query_methods_strategy) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
draper-4.0.1 | lib/draper/query_methods.rb |
draper-4.0.0 | lib/draper/query_methods.rb |