Skip to content

Instantly share code, notes, and snippets.

@phawk
Created November 5, 2013 16:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save phawk/7322115 to your computer and use it in GitHub Desktop.
def my_sample_method
# inputs
people = []
# work
people = Person.all
raise CustomError, "No people found." unless people.size > 0
# outputs
return people.to_json
resuce CustomError => e
# handling errors
return { status: false, error: e.message }.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment