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

Map each ORM exceptions to Rango HTTP errors #141

@botanicus

Description

@botanicus
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions