Class: Admin::PromotionRulesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::PromotionRulesController
- Defined in:
- app/controllers/admin/promotion_rules_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/admin/promotion_rules_controller.rb', line 2 def create @promotion = Promotion.find(params[:promotion_id]) @promotion_rule = params[:promotion_rule][:type].constantize.new(params[:promotion_rule]) @promotion_rule.promotion = @promotion if @promotion_rule.save flash[:notice] = I18n.t(:successfully_created, :resource => I18n.t(:promotion_rule)) end respond_to do |format| format.html { redirect_to edit_admin_promotion_path(@promotion)} format.js { render :layout => false } end end |
#destroy ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/admin/promotion_rules_controller.rb', line 15 def destroy @promotion = Promotion.find(params[:promotion_id]) @promotion_rule = @promotion.promotion_rules.find(params[:id]) if @promotion_rule.destroy flash[:notice] = I18n.t(:successfully_removed, :resource => I18n.t(:promotion_rule)) end respond_to do |format| format.html { redirect_to edit_admin_promotion_path(@promotion)} format.js { render :layout => false } end end |