app/controllers/tang/admin/coupons_controller.rb in tang-0.0.1 vs app/controllers/tang/admin/coupons_controller.rb in tang-0.0.8

- old
+ new

@@ -1,14 +1,16 @@ require_dependency "tang/application_controller" module Tang class Admin::CouponsController < Admin::ApplicationController - before_action :set_coupon, only: [:show, :edit, :update, :destroy] + before_action :set_coupon, only: [:show, :destroy] # GET /coupons def index - @coupons = Coupon.all + @coupons = Coupon.all. + paginate(page: params[:page]). + order(:stripe_id) end # GET /coupons/1 def show end @@ -16,30 +18,17 @@ # GET /coupons/new def new @coupon = Coupon.new end - # GET /coupons/1/edit - def edit - end - # POST /coupons def create @coupon = Coupon.new(coupon_params) if @coupon.save redirect_to [:admin, @coupon], notice: 'Coupon was successfully created.' else render :new - end - end - - # PATCH/PUT /coupons/1 - def update - if @coupon.update(coupon_params) - redirect_to [:admin, @coupon], notice: 'Coupon was successfully updated.' - else - render :edit end end # DELETE /coupons/1 def destroy