Sha256: 337a79398249196d64a2e44fec2088e374b9aaa5cc586337dacd50ee56dbdbea

Contents?: true

Size: 1.43 KB

Versions: 8

Compression:

Stored size: 1.43 KB

Contents

require_dependency "apidae/application_controller"

module Apidae
  class ObjectsController < ApplicationController
    before_action :set_object, only: [:show, :edit, :update, :destroy]

    # GET /objects
    def index
      @objects = Object.all
    end

    # GET /objects/1
    def show
    end

    # GET /objects/new
    def new
      @object = Object.new
    end

    # GET /objects/1/edit
    def edit
    end

    # POST /objects
    def create
      @object = Object.new(object_params)

      if @object.save
        redirect_to @object, notice: 'Object was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /objects/1
    def update
      if @object.update(object_params)
        redirect_to @object, notice: 'Object was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /objects/1
    def destroy
      @object.destroy
      redirect_to objects_url, notice: 'Object was successfully destroyed.'
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_object
        @object = Object.find(params[:id])
      end

      # Only allow a trusted parameter "white list" through.
      def object_params
        params.require(:object).permit(:address, :apidae_id, :apidae_type, :apidae_subtype, :title, :short_desc, :contact, :long_desc, :type_data, :latitude, :longitude, :openings, :rates, :reservation)
      end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
apidae-0.1.6 app/controllers/apidae/objects_controller.rb
apidae-0.1.5 app/controllers/apidae/objects_controller.rb
apidae-0.1.4 app/controllers/apidae/objects_controller.rb
apidae-0.1.3 app/controllers/apidae/objects_controller.rb
apidae-0.1.2 app/controllers/apidae/objects_controller.rb
apidae-0.1.1 app/controllers/apidae/objects_controller.rb
apidae-0.1.0 app/controllers/apidae/objects_controller.rb
apidae-engine-rails-0.1.0 app/controllers/apidae/objects_controller.rb