优化下代码

This commit is contained in:
z9hang 2015-01-23 16:31:41 +08:00
parent 4a672416e3
commit b2396df68c
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,6 @@
module Mobile module Mobile
module Entities module Entities
#匿评作品页面相关参数
class AnonymousWorksParams < Grape::Entity class AnonymousWorksParams < Grape::Entity
def self.anonymous_works_params_expose(field) def self.anonymous_works_params_expose(field)
expose field do |f,opt| expose field do |f,opt|
@ -12,6 +13,8 @@ module Mobile
end end
anonymous_works_params_expose :is_teacher anonymous_works_params_expose :is_teacher
anonymous_works_params_expose :m_score anonymous_works_params_expose :m_score
anonymous_works_params_expose :is_anonymous_comments
anonymous_works_params_expose :cur_type
expose :jours ,using: Mobile::Entities::Jours do |f, opt| expose :jours ,using: Mobile::Entities::Jours do |f, opt|
if f.is_a?(Hash) && f.key?(:jours) if f.is_a?(Hash) && f.key?(:jours)
f[:jours] f[:jours]
@ -27,9 +30,6 @@ module Mobile
f[:student_stars] f[:student_stars]
end end
end end
anonymous_works_params_expose :is_anonymous_comments
anonymous_works_params_expose :cur_type
end end
end end
end end