Skip to content

Instantly share code, notes, and snippets.

@coderdan
Created September 4, 2012 07:35
Show Gist options
  • Save coderdan/3618035 to your computer and use it in GitHub Desktop.
Save coderdan/3618035 to your computer and use it in GitHub Desktop.
class CustomerAPI < Grape::API
version 'v1', :using => :header
resource :users do
desc "Will Error!"
post :silly do
error("You're silly", 500)
end
desc "Smarter version of all Users"
get do
users = User.all
users.empty? ? error("No content", 204) : users.to_json
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment