Module: ElocalApiSupport::Actions::Destroy

Defined in:
lib/elocal_api_support/actions/destroy.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



4
5
6
7
8
9
10
11
12
# File 'lib/elocal_api_support/actions/destroy.rb', line 4

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