8 lines
228 B
Ruby
8 lines
228 B
Ruby
module BooksHelper
|
|
def cart_summary
|
|
number_to_currency(@books.map{ |b| b.price }.reduce(:+))
|
|
end
|
|
def can_book_be_added?(book)
|
|
logged_in? && book.quantity.positive? && !current_user.books.exists?(book.id)
|
|
end
|
|
end
|