fixed file loop for jounral paper show

This commit is contained in:
Saurabh Bhatia 2014-07-02 10:29:13 +08:00
parent 4cfa591260
commit a3c66b1a6e
1 changed files with 3 additions and 3 deletions

View File

@ -95,9 +95,9 @@ class JournalPaper
attribute_values = self.attributes.select{|k,v| v if (k.in?(["year","language","isbn","vol_no","issue_no","form_to_start","form_to_end","total_pages","keywords","abstract","publication_date","url","note"]) && v.present?)}
localized_fields = {"paper_title" => self.attributes["paper_title"][I18n.locale], "journal_title" => self.attributes["journal_title"][I18n.locale]}
authors = {"authors" => self.authors}
files = Hash.new
self.journal_paper_files.each do |f| files = {"file_link" => url_to_file(f.journal_file.url, f.title)} end
values = [attribute_values, localized_fields, authors,files]
files = {}
files = self.journal_paper_files.collect do |f| {f.title => url_to_file(f.journal_file.url, f.title)} end
values = [attribute_values, localized_fields, authors] + files
values.inject(&:merge)
end