搜索课程报错
This commit is contained in:
parent
9b51a25a26
commit
8fe5fee0f0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue