Class: Lcms::Engine::SearchDocumentSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- Lcms::Engine::SearchDocumentSerializer
- Defined in:
- app/serializers/lcms/engine/search_document_serializer.rb
Instance Method Summary collapse
Instance Method Details
#grade ⇒ Object
28 29 30 |
# File 'app/serializers/lcms/engine/search_document_serializer.rb', line 28 def grade object.grades&.average end |
#path ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/serializers/lcms/engine/search_document_serializer.rb', line 9 def path if model_type == 'page' object.permalink else return media_path(object.model_id) if media? return generic_path(object.model_id) if generic? object.slug ? show_with_slug_path(object.slug) : resource_permalink end end |
#type_name ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/serializers/lcms/engine/search_document_serializer.rb', line 20 def type_name if generic? && object.grade.present? "#{object.grades.to_str} #{object.doc_type.titleize}" else object.doc_type.titleize end end |