Class: Sprangular::ProductsController
Instance Method Summary
collapse
#invalid_resource!, #not_found, #unauthorized
Instance Method Details
#index ⇒ Object
2
3
4
5
6
7
8
9
10
|
# File 'app/controllers/sprangular/products_controller.rb', line 2
def index
@products = product_scope
@products = @products.where("spree_prices.amount IS NOT NULL").where("spree_prices.currency" => current_currency) unless Spree::Config.show_products_without_price
@products = @products.ransack(params[:q]).result if params[:q]
@products = @products.distinct.page(params[:page]).per(params[:per_page])
@cache_key = [I18n.locale, @current_user_roles.include?('admin'), current_currency, params[:q], params[:per_page], params[:per_page]]
render 'index'
end
|
#show ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/sprangular/products_controller.rb', line 12
def show
@product = product_scope.where(slug: params[:id]).first!
render 'spree/api/products/show'
end
|