Skip to content

Instantly share code, notes, and snippets.

@karledurante
Created April 30, 2012 14:29
Show Gist options
  • Save karledurante/2558804 to your computer and use it in GitHub Desktop.
Save karledurante/2558804 to your computer and use it in GitHub Desktop.
controller if blocks
class SomeController
def service
resource = Locator.find(params[:id])
if resource.blank?
render :status => 404, :text => "Resource could not be found"
else
render :json => resource
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment