Sha256: 311534ac687a9fc2e3f8a7268967b9e9f056a7814bc152d653baf92efbaed7e4
Contents?: true
Size: 640 Bytes
Versions: 6
Compression:
Stored size: 640 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 && 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
6 entries across 6 versions & 1 rubygems