Sha256: fd829a30f88f80911cc4be67911928bb454a2a8c4d6554d79c39732d884d1ecb

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

require_relative 'application_controller'

class ItemListsController < ApplicationController
  def index
    @item_lists = ExampleCom::ItemList.all
  end

  def new
    @item_list = ExampleCom::ItemList.new
  end

  def create
    @item_list = ExampleCom::ItemList.new(item_list_params)

    if @item_list.save
      redirect_to(item_list_path(@item_list))
    else
      render 'new'
    end
  end

  def show
    @item_list = find_item_list
  end

  def edit
    @item_list = find_item_list
  end

  def update
    @item_list = ExampleCom::ItemList.new(id: params[:id])

    if @item_list.update_attributes(item_list_params)
      redirect_to item_list_path(@item_list)
    else
      render 'edit'
    end
  end


  def destroy
    ExampleCom::ItemList.destroy(params[:id])

    redirect_to item_lists_path
  end

  protected
  def find_item_list
    ExampleCom::ItemList.find(params[:id])
  end

  def item_list_params
    params[:item_list]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
signaling-1.1.2 spec/support/integration/item_lists_controller.rb
signaling-1.1.1 spec/support/integration/item_lists_controller.rb
signaling-1.1.0 spec/support/integration/item_lists_controller.rb
signaling-1.0.0 spec/support/integration/item_lists_controller.rb