Class: SimpleForm::Bulma::ItemsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/simple_form/bulma/items_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /items



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/simple_form/bulma/items_controller.rb', line 16

def create
  @item = Item.new(item_params)

  if @item.valid?
    Item.all << @item
    redirect_to @item, notice: 'Item was successfully created.'
  else
    render :new
  end
end

#indexObject

GET /items



6
7
8
# File 'app/controllers/simple_form/bulma/items_controller.rb', line 6

def index
  @items = Item.all
end

#newObject

GET /items/new



11
12
13
# File 'app/controllers/simple_form/bulma/items_controller.rb', line 11

def new
  @item = Item.new
end