Sha256: 23f1ae1b425e325e41d61a6c07f81acfc4132846b2cbf8cd2621de91494587b6

Contents?: true

Size: 856 Bytes

Versions: 9

Compression:

Stored size: 856 Bytes

Contents

module Hippo
    module API


        class GenericController < ControllerBase

            def show
                perform_retrieval
            end

            def create
                record  = model.from_attribute_data(data, current_user)
                options = build_reply_options.merge(success: record.save)
                std_api_reply(:create, record, options)
            end

            def update
                if params[:id]
                    perform_single_update
                elsif data.is_a?(Array)
                    perform_multiple_updates
                end
            end

            def destroy
                if params[:id]
                    perform_single_destroy
                elsif data.is_a?(Array)
                    perform_multiple_destroy
                end
            end

        end
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hippo-fw-0.9.9 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.8 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.7 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.6 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.5 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.4 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.3 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.2 lib/hippo/api/generic_controller.rb
hippo-fw-0.9.1 lib/hippo/api/generic_controller.rb