Class: PointsProgram::SignUpBasedController
- Inherits:
-
BaseController
- Object
- BaseController
- PointsProgram::SignUpBasedController
- Defined in:
- app/controllers/admin/points_program/sign_up_based_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 17 def create @points_program = SpecialBonus.new params.require(:special_bonus).permit! @points_program.campaign_type = 3 if @points_program.save redirect_to admin_points_program_sign_up_based_index_path else flash.now[:alert] = @points_program.errors..to_sentence render 'edit' end end |
#destroy ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 39 def destroy if @points_program.delete redirect_to admin_points_program_sign_up_based_index_path, notice: 'Delete success' else redirect_to admin_points_program_sign_up_based_index_path, alert: 'Delete failed' end end |
#edit ⇒ Object
28 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 28 def edit; end |
#index ⇒ Object
7 8 9 10 11 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 7 def index @points_programs = SpecialBonus.where(SpecialBonus.arel_table[:sign_up_code].not_eq(nil)) etag = CityHash.hash32([self.class.to_s, @points_programs.cache_key]) return unless stale?(etag: etag) end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 13 def new @points_program = SpecialBonus.new # campaign_type: 3 end |
#update ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/controllers/admin/points_program/sign_up_based_controller.rb', line 30 def update if @points_program.update_attributes params.require(:special_bonus).permit! redirect_to admin_points_program_sign_up_based_index_path, notice: 'Data updated' else flash.now.alert = @points_program.errors..to_sentence render 'edit' end end |