Class: Spree::Admin::PromotionRulesController
Instance Method Summary
collapse
#set_user_language_locale_key
Instance Method Details
#create ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/spree/admin/promotion_rules_controller.rb', line 9
def create
@promotion_rule = @promotion_rule_type.new(promotion_rule_params)
@promotion_rule.promotion = @promotion
if @promotion_rule.save
flash[:success] = t('spree.successfully_created', resource: t('spree.promotion_rule'))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
format.js { render layout: false }
end
end
|
#destroy ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/spree/admin/promotion_rules_controller.rb', line 21
def destroy
@promotion_rule = @promotion.promotion_rules.find(params[:id])
if @promotion_rule.destroy
flash[:success] = t('spree.successfully_removed', resource: t('spree.promotion_rule'))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
format.js { render layout: false }
end
end
|