Sha256: e7e69d188ed0af7d64ccbd82cd6d65ceb5fd19654968ba691aab44f7adbb870e

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

class RailsTradeAdmin::PaymentStrategiesController < RailsTradeAdmin::BaseController
  before_action :set_payment_strategy, only: [:show, :edit, :update, :destroy]

  def index
    @payment_strategies = PaymentStrategy.all
  end

  def show
  end

  def new
    @payment_strategy = PaymentStrategy.new
  end

  def edit
  end

  def create
    @payment_strategy = PaymentStrategy.new(payment_strategy_params)

    if @payment_strategy.save
      redirect_to admin_payment_strategies_url, notice: 'Payment strategy was successfully created.'
    else
      render :new
    end
  end

  def update
    if @payment_strategy.update(payment_strategy_params)
      redirect_to admin_payment_strategies_url, notice: 'Payment strategy was successfully updated.'
    else
      render :edit
    end
  end

  def destroy
    @payment_strategy.destroy
    redirect_to admin_payment_strategies_url, notice: 'Payment strategy was successfully destroyed.'
  end

  private
  def set_payment_strategy
    @payment_strategy = PaymentStrategy.find(params[:id])
  end

  def payment_strategy_params
    params.fetch(:payment_strategy, {}).permit(:name, :strategy, :period)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_trade-0.0.1 app/controllers/the_trade_admin/payment_strategies_controller.rb