From 0d6ab9100c166c1e84f2b6668d6a43e77d50482a Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 13 Nov 2019 12:24:41 +0800 Subject: [PATCH] Update personal_books_helper.rb add show member method --- app/helpers/admin/personal_books_helper.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helpers/admin/personal_books_helper.rb b/app/helpers/admin/personal_books_helper.rb index 87e6daa..622309b 100644 --- a/app/helpers/admin/personal_books_helper.rb +++ b/app/helpers/admin/personal_books_helper.rb @@ -1,13 +1,16 @@ module Admin::PersonalBooksHelper - def get_authors_text(book) + def get_authors_text(book) (book.authors.to_s.blank? ? get_member(book).collect(&:name).join('/') : Nokogiri::HTML(book.authors.to_s).text rescue '') end def get_authors_show(book) - (book.authors.to_s.blank? ? get_member(book).collect{|member| "#{member.name}"}.join('/') : book.authors.to_s rescue '') + (book.authors.to_s.blank? ? get_member_show(book) : book.authors.to_s) rescue '' end def get_member(book) Array(MemberProfile.find(Array(book).collect(&:member_profile_id))) end + def get_member_show(book) + get_member(book).collect{|member| "#{member.name}"}.join('/') + end def get_publisher(book) book.publisher end