class CheckByHit

this class provides the functionality to inherit the base class to provide the products by ranking highest selling product.

Public Class Methods

new(param) click to toggle source

this method initializes base class object with the store detail

Calls superclass method BasicWay::new
# File lib/product_home_template.rb, line 34
def initialize(param)
    super(param)
end

Public Instance Methods

my_special_method(pages) click to toggle source

this method to run the logic of sorting the products with pagination by ranking the hit

# File lib/product_home_template.rb, line 39
def my_special_method(pages)
    @product_by_hits = @store_detail.products.order('hit asc').paginate(page: pages, per_page: 3).take(3)
    puts("===== by hit =====")
    puts(@product_by_hits)
    return @product_by_hits
end
my_special_method_without(member) click to toggle source

this method to run the logic of sorting the products without pagination by ranking the hit

# File lib/product_home_template.rb, line 47
def my_special_method_without(member)
    @product_by_hits = @store_detail.products.order('hit asc').take(3)
    return @product_by_hits
end