ResourceApp.controllers do get '/:resource_key', :provides => :json do Resource.find_by_resource_key(params[:resource_key]) end post '/', :provides => :json do resource = Resource.build(params) send_custom_response(resource, nil, [], 201, nil, content_type, []) end put '/:resource_key/value/:value', :provides => :json do resource = Resource.find_by_resource_key(params[:resource_key]) resource.update_attributes!(:resource_value => params[:value]) status 204 end put '/:resource_key/delete', :provides => :json do Resource.find_by_resource_key(params[:resource_key]).delete status 204 end end