Class: Spree::Admin::FavoriteProductsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/favorite_products_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
# File 'app/controllers/spree/admin/favorite_products_controller.rb', line 5

def index
  @search = Spree::Product.favorite.search(params[:q])
  @favorite_products = @search.result.order_by_favorite_users_count(sort_in_ascending_users_count?).page(params[:page])
end

#usersObject



10
11
12
13
# File 'app/controllers/spree/admin/favorite_products_controller.rb', line 10

def users
  @product = Spree::Product.where(:id => params[:id]).first
  @users = @product.favorite_users.page(params[:page])
end