Class: Spree::Variants::Find

Inherits:
Object
  • Object
show all
Defined in:
app/finders/spree/variants/find.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope:, params:) ⇒ Find

Returns a new instance of Find.



4
5
6
7
# File 'app/finders/spree/variants/find.rb', line 4

def initialize(scope:, params:)
  @scope = scope
  @options = params.dig(:filter, :options).try(:to_unsafe_hash)
end

Instance Method Details

#executeObject



9
10
11
12
# File 'app/finders/spree/variants/find.rb', line 9

def execute
  variants = by_options(scope)
  variants.distinct
end