image issue solved

This commit is contained in:
Harry Bomrah 2017-07-05 12:04:20 +08:00
parent edf6e6e832
commit a0a0a92781
1 changed files with 5 additions and 2 deletions

View File

@ -4,8 +4,9 @@ class HpsLearningsController < ApplicationController
classes = []
HpsClass.all.desc(:created_at).each do |hpsclass|
if hpsclass.hps_lectures.count > 0
thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url
classes << {
"course_pic_thumb" => (hpsclass.course_pic.thumb.url rescue "http://www.placehold.it/150x150/EFEFEF/AAAAAA"),
"course_pic_thumb" => thumb,
"course_pic" => (hpsclass.course_pic.url rescue ""),
"title" => hpsclass.title,
"category" => hpsclass.category.title,
@ -29,8 +30,10 @@ class HpsLearningsController < ApplicationController
lectures = []
hpsclass.hps_lectures.each do |lecture|
if !lecture.hps_lecture_file.nil? && !lecture.hps_lecture_file.index_path.nil?
thumb = lecture.lecture_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : lecture.lecture_pic.thumb.url
lectures << {
"lecture_pic_thumb" => (lecture.lecture_pic.thumb.url rescue "http://www.placehold.it/150x150/EFEFEF/AAAAAA"),
"lecture_pic_thumb" => thumb,
"lecture_pic" => (lecture.lecture_pic.url rescue ""),
"subject" => lecture.subject,
"presenter" => lecture.presenter,