Sha256: a06ed9c89871e8c03a4a5a27fbdd36cd2cb7dc2c65c3072476b911ca9e18e3bb
Contents?: true
Size: 655 Bytes
Versions: 54
Compression:
Stored size: 655 Bytes
Contents
module Spree module Api class PromotionsController < Spree::Api::BaseController before_filter :requires_admin before_filter :load_promotion def show if @promotion respond_with(@promotion, default_template: :show) else raise ActiveRecord::RecordNotFound end end private def requires_admin return if @current_user_roles.include?("admin") unauthorized and return end def load_promotion @promotion = Spree::Promotion.find_by_id(params[:id]) || Spree::Promotion.with_coupon_code(params[:id]) end end end end
Version data entries
54 entries across 54 versions & 2 rubygems