Sha256: 016623ff3208c5fffbf84c89f59191a0ffc9d1ec78cd42d8833d391bf510189c
Contents?: true
Size: 640 Bytes
Versions: 20
Compression:
Stored size: 640 Bytes
Contents
module Spree module Api class PromotionsController < Spree::Api::BaseController before_action :requires_admin before_action :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 && 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
20 entries across 20 versions & 1 rubygems