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



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

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



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

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

#editObject



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

def edit
end

#indexObject



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

def index
  @stocks = Iro::Stock.all
end

#newObject



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

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

#showObject



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

def show
end

#updateObject



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

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