Sha256: 4e4a934386176b983dd139a00381edd5b3c1c5cdf62a48fb7af76f5810a239ab

Contents?: true

Size: 686 Bytes

Versions: 10

Compression:

Stored size: 686 Bytes

Contents

module Spree
  module OptionValues
    class FindAvailable
      include ProductFilterable

      def initialize(scope: OptionValue.spree_base_scopes, products_scope: Product.spree_base_scopes)
        @scope = scope
        @products_scope = products_scope
      end

      def execute
        find_available(scope, products_scope).select(select_args).order(order_args)
      end

      private

      attr_reader :scope, :products_scope

      def select_args
        "#{OptionValue.table_name}.*, #{OptionType.table_name}.position AS option_type_position"
      end

      def order_args
        "option_type_position, #{OptionValue.table_name}.position"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_core-4.5.5 app/finders/spree/option_values/find_available.rb
spree_core-4.4.1 app/finders/spree/option_values/find_available.rb
spree_core-4.5.4 app/finders/spree/option_values/find_available.rb
spree_core-4.5.3 app/finders/spree/option_values/find_available.rb
spree_core-4.5.2 app/finders/spree/option_values/find_available.rb
spree_core-4.5.1 app/finders/spree/option_values/find_available.rb
spree_core-4.5.0 app/finders/spree/option_values/find_available.rb
spree_core-4.4.0 app/finders/spree/option_values/find_available.rb
spree_core-4.4.0.rc2 app/finders/spree/option_values/find_available.rb
spree_core-4.4.0.rc1 app/finders/spree/option_values/find_available.rb