Sha256: fa68854121993a82a4e3a8591ca2328323b6018463bad6345f5d11534fdb47e1
Contents?: true
Size: 919 Bytes
Versions: 1
Compression:
Stored size: 919 Bytes
Contents
class Iro::StocksController < Iro::ApplicationController before_action :set_stock, only: [:show, :edit, :update, :destroy] def index @stocks = Iro::Stock.all authorize! :index, Iro::Stock end def show end def new @stock = Iro::Stock.new end def edit end def create @stock = Iro::Stock.new(stock_params) if @stock.save redirect_to action: :index, notice: 'Stock was successfully created.' else render :new end end def update if @stock.update(stock_params) redirect_to @stock, notice: 'Stock was successfully updated.' else render :edit end end def destroy @stock.destroy redirect_to stocks_url, notice: 'Stock was successfully destroyed.' end ## ## private ## private def set_stock @stock = Iro::Stock.find(params[:id]) end def stock_params params.require(:stock).permit! end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iron_warbler-2.0.7.8 | app/controllers/iro/stocks_controller.rb |