Merge pull request #944 from sonalkr132/serializers-test
Serializers test
This commit is contained in:
commit
ad77bea1db
7 changed files with 225 additions and 18 deletions
|
|
@ -7,7 +7,7 @@ class ConferenceSerializer < ActiveModel::Serializer
|
|||
object.program.difficulty_levels.map do |difficulty_level| { id: difficulty_level.id,
|
||||
title: difficulty_level.title,
|
||||
description: difficulty_level.description
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ class ConferenceSerializer < ActiveModel::Serializer
|
|||
title: event_type.title,
|
||||
length: event_type.length,
|
||||
description: event_type.description
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -36,9 +36,9 @@ class ConferenceSerializer < ActiveModel::Serializer
|
|||
difficulty_level_id: event.difficulty_level_id,
|
||||
track_id: event.track_id,
|
||||
speaker_names: event.speaker_names
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
[]
|
||||
|
|
@ -49,22 +49,10 @@ class ConferenceSerializer < ActiveModel::Serializer
|
|||
object.program.tracks.map do |track| { 'id' => track.id,
|
||||
'name' => track.name,
|
||||
'description' => track.description
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def name
|
||||
object.title
|
||||
end
|
||||
|
||||
def year
|
||||
object.start_date.try(:year)
|
||||
end
|
||||
|
||||
def socialtag
|
||||
object.contact.social_tag
|
||||
end
|
||||
|
||||
def revision
|
||||
object.revision || 0
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class EventSerializer < ActiveModel::Serializer
|
|||
|
||||
def date
|
||||
t = object.start_time
|
||||
t.blank? ? '' : %{ #{l t, format: :short}#{t.formatted_offset(false)} }
|
||||
t.blank? ? '' : %{ #{I18n.l t, format: :short}#{t.formatted_offset(false)} }
|
||||
end
|
||||
|
||||
def speaker_ids
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue