Class: SolidusFriendlyPromotions::Admin::ConditionsController
- Inherits:
-
Spree::Admin::BaseController
- Object
- Spree::Admin::BaseController
- SolidusFriendlyPromotions::Admin::ConditionsController
- Defined in:
- app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb', line 16 def create @condition = @benefit.conditions.build(condition_params) if @condition.save flash[:success] = t("spree.successfully_created", resource: model_class.model_name.human) end redirect_to location_after_save end |
#destroy ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb', line 35 def destroy @condition = @benefit.conditions.find(params[:id]) if @condition.destroy flash[:success] = t("spree.successfully_removed", resource: model_class.model_name.human) end redirect_to location_after_save end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb', line 11 def new @condition = @benefit.conditions.build(condition_params) render layout: false end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb', line 25 def update @condition = @benefit.conditions.find(params[:id]) @condition.assign_attributes(condition_params) if @condition.save flash[:success] = t("spree.successfully_updated", resource: model_class.model_name.human) end redirect_to location_after_save end |