Sha256: 385dbea145b5671fc4631dde80a6666f30f668461180850321e60e39b2d45fc1

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require_dependency "iro/application_controller"


class Iro::AlertsController < ApplicationController
  before_action :set_alert, only: [:show, :edit, :update, :destroy]

  # GET /alerts
  def index
    @alerts = Alert.all
  end

  # GET /alerts/1
  def show
  end

  # GET /alerts/new
  def new
    @alert = Alert.new
  end

  # GET /alerts/1/edit
  def edit
  end

  # POST /alerts
  def create
    @alert = Alert.new(alert_params)

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

  # PATCH/PUT /alerts/1
  def update
    if @alert.update(alert_params)
      redirect_to @alert, notice: 'Alert was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /alerts/1
  def destroy
    @alert.destroy
    redirect_to alerts_url, notice: 'Alert was successfully destroyed.'
  end

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

    # Only allow a list of trusted parameters through.
    def alert_params
      params.require(:alert).permit(:class_name, :kind, :symbol, :direction, :strike, :profile_id)
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iron_warbler-2.0.4 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.3 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.2 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.1 app/controllers/iro/alerts_controller.rb