Sha256: 65cadc90a1adcf9568c4eeefb79d24db3bf355c8dffa7eec3f4154c19a1779ac

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

require_dependency 'simple_form/bulma/application_controller'

module SimpleForm::Bulma
  class ItemsController < ApplicationController
    # GET /items
    def index
      @items = Item.all
    end

    # GET /items/new
    def new
      @item = Item.new
    end

    # POST /items
    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

    private

    def item_params
      params.require(:item)
            .permit(:name, :url, :secret_key, :active, :description, :background,
                    :serial_number, :quantity, :published_at, :expired_at,
                    :daily_check_at)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_form-bulma-0.1.0 app/controllers/simple_form/bulma/items_controller.rb