Skip to content
This repository
tree: d313d707b2
Fetching contributors…

Cannot retrieve contributors at this time

file 21 lines (19 sloc) 0.579 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
class ThingsController < ApplicationController
  respond_to :json

  def show
    @things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 20)
    unless @things.blank?
      respond_with @things
    else
      render(:json => {"errors" => {"address" => [t("errors.not_found", :thing => t("defaults.thing"))]}}, :status => 404)
    end
  end

  def update
    @thing = Thing.find(params[:id])
    if @thing.update_attributes(params[:thing])
      respond_with @thing
    else
      render(:json => {"errors" => @thing.errors}, :status => 500)
    end
  end
end
Something went wrong with that request. Please try again.