搜索课程报错

This commit is contained in:
guange 2014-12-23 09:44:31 +08:00
parent 9b51a25a26
commit 8fe5fee0f0
1 changed files with 9 additions and 2 deletions

View File

@ -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