What I have
===========

I now have a route like

```
get 'book/:id' => 'books#show', as: :book

```

The code to create that URL is:

```
book_path @book

```

In the controller:

```
@book = Book.find(params[:id])

```

So far so good. Now, this id is obviously the internal ActiveRecord or database primary key. 

What I want
===========

Instead, I would (in this ficticious example) use the ISBN instead. I could do this like so:

```
get 'book/:isbn' => 'books#show', as: :book
book_path(isbn: @book.isbn)
@book = Book.find_by(isbn: params[:isbn])

```

This is a bit verbose; I want the convention "isbn" for this model in the whole application, and nobody should need to care about it, ever. So, I want my 3 lines to look like this:

```
get 'book/:isbn' => 'books#show', as: :book
book_path @book    # (!)
@book = Book.find(params[:isbn])    # (!)

```

Is it possible to configure the route so that my wish comes true? Obviously, this should automatically work *everywhere*, at the very least for GET requests where the user sees the ISBN in the URL.

In case it matters, the `#isbn` attribute is not a primary key in the usual sense, but it is guaranteed that there is only ever one record with a particular ISBN in the table. So at least this part of the Primary Key contract is fulfilled.