lib/trailblazer/finder/adapters/data_mapper.rb in trailblazer-finder-0.1.3 vs lib/trailblazer/finder/adapters/data_mapper.rb in trailblazer-finder-0.1.4
- old
+ new
@@ -1,30 +1,32 @@
require 'trailblazer/finder/adapters/data_mapper/paging'
-# require 'trailblazer/finder/adapters/data_mapper/sorting'
+require 'trailblazer/finder/adapters/data_mapper/sorting'
+require 'trailblazer/finder/adapters/data_mapper/predicates'
module Trailblazer
class Finder
module Adapters
# ActiveRecord Adapter
module DataMapper
def self.included(base)
base.extend ClassMethods
+ base.instance_eval do
+ include DataMapper::Predicates if defined?(Features::Predicate::ClassMethods)
+ end
end
module ClassMethods
- # :nocov:
def normalize_find_handler(handler, key)
case handler
when Symbol then ->(entity_type, value) { method(handler).call entity_type, value }
when Proc then handler
else ->(entity_type, value) { entity_type.all(key.to_sym => value) unless Utils::String.blank?(value) }
end
end
- # :nocov:
end
include Paging if defined?(Features::Paging::ClassMethods)
- # include Sorting if defined?(Features::Sorting::ClassMethods)
+ include Sorting if defined?(Features::Sorting::ClassMethods)
end
end
end
end