Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Map each ORM exceptions to Rango HTTP errors #141

Open
botanicus opened this issue Dec 18, 2009 · 0 comments
Open

Map each ORM exceptions to Rango HTTP errors #141

botanicus opened this issue Dec 18, 2009 · 0 comments

Comments

@botanicus
Copy link
Owner

quiet do
  DataMapper::ObjectNotFoundError = Class.new(NotFound)
end

So you rather than:

def show(id)
  post = Post.get(id)
  raise NotFound unless post
  render "post.html", post: post
end

use just:

def show(id)
  render "post.html", post: Post.get!(id)
end

Where should I put it? Generate it to the beginning of models? Somewhere to lib/rango/orm?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant