Rescue when member plugin's publication_date is nil

This commit is contained in:
Manson Wang 2013-11-22 16:33:12 +08:00
parent 8af5112d24
commit 01ca178060
3 changed files with 12 additions and 8 deletions

View File

@ -91,9 +91,10 @@ class WritingBook
title << self.publisher if self.publisher.present? title << self.publisher if self.publisher.present?
title << self.isbn if self.isbn.present? title << self.isbn if self.isbn.present?
if !self.publish_date.nil?
pd = self.publish_date.strftime("%Y-%m-%d").split('-') pd = self.publish_date.strftime("%Y-%m-%d").split('-')
title << pd[0]+"/"+pd[1] title << pd[0]+"/"+pd[1]
end
# title << "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})" # title << "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})"
title.join(', ') title.join(', ')

View File

@ -88,9 +88,11 @@ class WritingConference
title << self.authors if self.authors.present? title << self.authors if self.authors.present?
if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-') pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0] title << pd[0]
end
title << self.paper_title if self.paper_title.present? title << self.paper_title if self.paper_title.present?
title << self.conference_title if self.conference_title.present? title << self.conference_title if self.conference_title.present?
title << self.location if self.location.present? title << self.location if self.location.present?

View File

@ -94,9 +94,10 @@ class WritingJournal
title << self.authors if self.authors.present? title << self.authors if self.authors.present?
if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-') pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0] title << pd[0]
end
title << self.paper_title if self.paper_title.present? title << self.paper_title if self.paper_title.present?
title << self.journal_title if self.journal_title.present? title << self.journal_title if self.journal_title.present?
title << self.vol_no if (self.vol_no.present? && self.vol_no != "0") title << self.vol_no if (self.vol_no.present? && self.vol_no != "0")