Sha256: 9602183fc9dc6aef7e5b3731c0925e73eb3db9268080f046420050d8bc8f9d03

Contents?: true

Size: 710 Bytes

Versions: 16

Compression:

Stored size: 710 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).includes(:translations).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

16 entries across 16 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/finders/spree/option_values/find_available.rb
spree_core-4.10.0 app/finders/spree/option_values/find_available.rb
spree_core-4.9.0 app/finders/spree/option_values/find_available.rb
spree_core-4.8.3 app/finders/spree/option_values/find_available.rb
spree_core-4.8.2 app/finders/spree/option_values/find_available.rb
spree_core-4.7.3 app/finders/spree/option_values/find_available.rb
spree_core-4.6.6 app/finders/spree/option_values/find_available.rb
spree_core-4.6.5 app/finders/spree/option_values/find_available.rb
spree_core-4.7.2 app/finders/spree/option_values/find_available.rb
spree_core-4.7.1 app/finders/spree/option_values/find_available.rb
spree_core-4.6.4 app/finders/spree/option_values/find_available.rb
spree_core-4.7.0 app/finders/spree/option_values/find_available.rb
spree_core-4.6.3 app/finders/spree/option_values/find_available.rb
spree_core-4.6.2 app/finders/spree/option_values/find_available.rb
spree_core-4.6.1 app/finders/spree/option_values/find_available.rb
spree_core-4.6.0 app/finders/spree/option_values/find_available.rb