diff --git a/app/controllers/hps_learnings_controller.rb b/app/controllers/hps_learnings_controller.rb index 50caeac..2e583e5 100644 --- a/app/controllers/hps_learnings_controller.rb +++ b/app/controllers/hps_learnings_controller.rb @@ -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,