Class: Iro::StocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/iro/stocks_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#home

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/iro/stocks_controller.rb', line 20

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

#destroyObject



38
39
40
41
# File 'app/controllers/iro/stocks_controller.rb', line 38

def destroy
  @stock.destroy
  redirect_to stocks_url, notice: 'Stock was successfully destroyed.'
end

#editObject



17
18
# File 'app/controllers/iro/stocks_controller.rb', line 17

def edit
end

#indexObject



5
6
7
8
# File 'app/controllers/iro/stocks_controller.rb', line 5

def index
  @stocks = Iro::Stock.all
  authorize! :index, Iro::Stock
end

#newObject



13
14
15
# File 'app/controllers/iro/stocks_controller.rb', line 13

def new
  @stock = Iro::Stock.new
end

#showObject



10
11
# File 'app/controllers/iro/stocks_controller.rb', line 10

def show
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/iro/stocks_controller.rb', line 30

def update
  if @stock.update(stock_params)
    redirect_to @stock, notice: 'Stock was successfully updated.'
  else
    render :edit
  end
end