diff --git a/app/api/mobile/entities/course.rb b/app/api/mobile/entities/course.rb index b9823d9ac..8e5609f32 100644 --- a/app/api/mobile/entities/course.rb +++ b/app/api/mobile/entities/course.rb @@ -3,10 +3,17 @@ module Mobile class Course < Grape::Entity def self.course_expose(field) expose field do |f,opt| - f[:course][field] || f[:course].__send__(field) + o = nil + o = f.img_url if f.respond_to?(:img_url) + if f.is_a? ::Course + o = f.send(field) if f.respond_to?(field) + else + f[:course][field] || f[:course].__send__(field) + end + o end end - expose :img_url + course_expose :img_url course_expose :attachmenttype course_expose :class_period course_expose :code