Sha256: 86c091eb51befc4414ae7a3e0cc64a5b36acd8527938a4d06d70ffbe36f5e2b5
Contents?: true
Size: 672 Bytes
Versions: 50
Compression:
Stored size: 672 Bytes
Contents
# frozen_string_literal: true 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
50 entries across 50 versions & 2 rubygems