From 240b91c36ca9554c739bf94a4737588b7a066650 Mon Sep 17 00:00:00 2001 From: chiu Date: Fri, 1 Nov 2019 22:10:07 +0800 Subject: [PATCH] Update journal_papers_controller.rb --- app/controllers/admin/journal_papers_controller.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 25b0d5d..9e9f8c5 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -13,8 +13,15 @@ class Admin::JournalPapersController < OrbitMemberController params['journal_id'].each do |journal_id| journal_ids = journal_id.split('/') journals = JournalPaper.find(journal_ids) - members = get_member(journals).uniq - puts journals[0] + member_ids = journals.collect(&:member_profile_id).uniq + journals.each_with_index do |journal,index1| + if index1== 0 + journal.member_profile_id = member_ids + journal.save! + else + journal.delete + end + end end redirect_to :action=> 'index' end