Sha256: db5820ca1df38adcaa6657ae563e885a1a50f7d1c0e3066115892a1c07bb1de0

Contents?: true

Size: 389 Bytes

Versions: 6

Compression:

Stored size: 389 Bytes

Contents

module ElocalApiSupport
  module Actions
    module Destroy
      def destroy
        if lookup_object.destroy
          render json: lookup_object
        else
          render json: { errors: "Failed to destroy #{lookup_object}" }, status: 500
        end
      rescue ActiveRecord::RecordNotFound
        render json: {} # record not found is ok for destroy
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
elocal_api_support-0.1.9 lib/elocal_api_support/actions/destroy.rb
elocal_api_support-0.1.8 lib/elocal_api_support/actions/destroy.rb
elocal_api_support-0.1.7 lib/elocal_api_support/actions/destroy.rb
elocal_api_support-0.1.5 lib/elocal_api_support/actions/destroy.rb
elocal_api_support-0.1.4 lib/elocal_api_support/actions/destroy.rb
elocal_api_support-0.1.3 lib/elocal_api_support/actions/destroy.rb