On page 65, in a section under “Caching individual objects”, a code sample has the wrong file header.
You can refactor this in a superclass so that other presenters can use your
brand-new caching mechanism. Create a file in app/presenters/api/v1/presenter.rb
and extract the appropriate logic. You will also need to modify FilmPresenter.
The result for both files should look like the following:# app/presenters/api/v1/film_presenter.rb
class Api::V1::Presenter
[…]
Note that the file path is listed as “[…]/file_presenter.rb”, but the class is “Presenter”. The FilmPresenter class follows in a subsequent block after this one.
Affected version: P1.0
Present in:
Print copy via Bookshop.org
epub file
pdf file
Thanks!