Class: PointsProgram::RestaurantCampaignsController
- Inherits:
-
BaseController
- Object
- BaseController
- PointsProgram::RestaurantCampaignsController
- Defined in:
- app/controllers/admin/points_program/restaurant_campaigns_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #reservations ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 18 def create @restaurant_campaign = SpecialBonus.new params[:special_bonus] @restaurant_campaign.campaign_type = 1 if @restaurant_campaign.save redirect_to admin_points_program_restaurant_campaigns_path else set_restaurants render 'edit' end end |
#destroy ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 43 def destroy if @restaurant_campaign.delete redirect_to admin_points_program_restaurant_campaigns_path, notice: 'Delete success' else redirect_to admin_points_program_restaurant_campaigns_path, alert: 'Delete failed' end end |
#edit ⇒ Object
29 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 29 def edit; end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 8 def index @restaurant_campaigns = SpecialBonus.where(campaign_type: 1).page(params[:page]).per(50) etag = CityHash.hash32([self.class.to_s, @restaurant_campaigns.cache_key]) return unless stale?(etag: etag) end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 14 def new @restaurant_campaign = SpecialBonus.new end |
#reservations ⇒ Object
31 32 33 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 31 def reservations @reservations = @restaurant_campaign.restaurant_campaign_reservations.page(params[:page]).per(100) end |
#update ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/admin/points_program/restaurant_campaigns_controller.rb', line 35 def update if @restaurant_campaign.update_attributes params[:special_bonus] redirect_to admin_points_program_restaurant_campaigns_path, notice: 'Data updated' else render 'edit' end end |