Module: Care::AutoFinder::Findable

Extended by:
ActiveSupport::Concern
Included in:
Finder
Defined in:
lib/care/auto_finder/findable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#callObject



50
51
52
53
54
55
56
57
58
# File 'lib/care/auto_finder/findable.rb', line 50

def call
  collection = relation || self.class.relation

  chain_filter.each do |filter|
    collection = send(filter, collection)
  end

  collection.distinct
end

#initialize(options = {}) ⇒ Object



44
45
46
47
48
# File 'lib/care/auto_finder/findable.rb', line 44

def initialize(options = {})
  options = options.symbolize_keys
  @relation = options[:relation] || self.class.relation || options[:params][:relation]
  @params = options[:params] || options || {}
end