Class: Spree::Posts::Sort

Inherits:
BaseSorter show all
Defined in:
app/sorters/spree/posts/sort.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope, params = {}, allowed_sort_attributes = []) ⇒ Sort

Returns a new instance of Sort.



4
5
6
# File 'app/sorters/spree/posts/sort.rb', line 4

def initialize(scope, params = {}, allowed_sort_attributes = [])
  super(scope, params, allowed_sort_attributes)
end

Instance Method Details

#callObject



8
9
10
11
12
13
# File 'app/sorters/spree/posts/sort.rb', line 8

def call
  posts = by_param_attributes(scope)
  posts = select_translatable_fields(posts) if Spree.use_translations?

  posts.distinct
end