Update personal_journals_controller.rb

This commit is contained in:
chiu 2019-08-13 10:00:33 +08:00
parent 25116235bf
commit bdfbb40863
1 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class PersonalJournalsController < ApplicationController
journal_papers = Mongoid::Sessions.default[:journal_papers].find() journal_papers = Mongoid::Sessions.default[:journal_papers].find()
journal_papers_count = journal_papers.count journal_papers_count = journal_papers.count
journal_papers_temp = Mongoid::Sessions.default[:journal_papers].find().take(journal_papers_count) journal_papers_temp = Mongoid::Sessions.default[:journal_papers].find().take(journal_papers_count)
journal_papers_show = journal_papers_temp.select (|value| value[params[:selectbox]].include? params[:keywords]) journal_papers_show = journal_papers_temp.select {|value| value[params[:selectbox]].include? params[:keywords]}
else else
journal_paper_list = [] journal_paper_list = []
journal_papers.each do |journal_paper| journal_papers.each do |journal_paper|
@ -75,9 +75,11 @@ class PersonalJournalsController < ApplicationController
"all" => journal_papers_temp "all" => journal_papers_temp
} }
end end
if params[:selectbox] !=nil
{ {
"all" => journal_papers_show "all" => journal_papers_show
} }
end
end end
def show def show