Class: SolidusFriendlyPromotions::Admin::ConditionsController

Inherits:
Spree::Admin::BaseController
  • Object
show all
Defined in:
app/controllers/solidus_friendly_promotions/admin/conditions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

#destroyObject



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

#newObject



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

#updateObject



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