forked from saurabh/personal-journal
fixed nil condition error publication date
This commit is contained in:
parent
ddd3a378f6
commit
f811cfc34f
|
@ -17,6 +17,7 @@ class JournalPapersController < ApplicationController
|
||||||
def show
|
def show
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
journal_paper = JournalPaper.find_by(uid: params[:uid])
|
journal_paper = JournalPaper.find_by(uid: params[:uid])
|
||||||
|
publication_date = journal_paper.publication_date.to_date.strftime("%Y/%m/%d") rescue nil
|
||||||
files = journal_paper.journal_paper_files.map{|file| { "file_url" => file.journal_file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue []
|
files = journal_paper.journal_paper_files.map{|file| { "file_url" => file.journal_file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue []
|
||||||
{
|
{
|
||||||
"journal_paper_files" => files,
|
"journal_paper_files" => files,
|
||||||
|
@ -34,7 +35,7 @@ class JournalPapersController < ApplicationController
|
||||||
"total_pages" => journal_paper.total_pages,
|
"total_pages" => journal_paper.total_pages,
|
||||||
"keywords" => journal_paper.keywords,
|
"keywords" => journal_paper.keywords,
|
||||||
"abstract" => journal_paper.abstract,
|
"abstract" => journal_paper.abstract,
|
||||||
"publication_date" => journal_paper.publication_date.to_date.strftime("%Y/%m/%d"),
|
"publication_date" => publication_date,
|
||||||
"url" => journal_paper.url,
|
"url" => journal_paper.url,
|
||||||
"note" => journal_paper.note
|
"note" => journal_paper.note
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue