bookstore/app/presenters/books_presenter.rb

16 lines
281 B
Ruby
Raw Normal View History

2021-03-19 17:31:38 +02:00
class BooksPresenter < SimpleDelegator
include ActiveSupport::NumberHelper
def price
2021-03-21 20:30:25 +01:00
super / 100
end
def price_with_currency
number_to_currency(price)
2021-03-19 17:31:38 +02:00
end
def authors
super.map { |author| "#{author.first_name} #{author.last_name}" }.join(', ')
end
end