Sha256: 03082ad6c069d9a3aeb33818f7a97d6853e2ba65f62100cac9f56b58f2a1ad5c

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

class CurrenciesController < ApplicationController
  before_action :set_currency, only: [:show, :edit, :update, :destroy]

  # GET /currencies
  def index
    @currencies = Currency.all
  end

  # GET /currencies/1
  def show
  end

  # GET /currencies/new
  def new
    @currency = Currency.new
  end

  # GET /currencies/1/edit
  def edit
  end

  # POST /currencies
  def create
    @currency = Currency.new(currency_params)

    if @currency.save
      redirect_to @currency, notice: 'Currency was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /currencies/1
  def update
    if @currency.update(currency_params)
      redirect_to @currency, notice: 'Currency was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /currencies/1
  def destroy
    @currency.destroy
    redirect_to currencies_url, notice: 'Currency was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_currency
      @currency = Currency.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def currency_params
      params[:currency]
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
we_bridge_rails_engine_nations-0.1.3 app/controllers/currencies_controller.rb
we_bridge_rails_engine_nations-0.1.2 app/controllers/currencies_controller.rb
we_bridge_rails_engine_nations-0.1.1 app/controllers/currencies_controller.rb
we_bridge_rails_engine_nations-0.1.0 app/controllers/currencies_controller.rb