Class: Goldencobra::ArticleCustomSerializer
- Inherits:
-
ArticleSerializer
- Object
- ActiveModel::Serializer
- ArticleSerializer
- Goldencobra::ArticleCustomSerializer
- Defined in:
- app/serializers/goldencobra/article_custom_serializer.rb
Instance Method Summary collapse
-
#attributes ⇒ Object
Includes all defined methods.
Methods inherited from ArticleSerializer
Instance Method Details
#attributes ⇒ Object
Includes all defined methods
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/serializers/goldencobra/article_custom_serializer.rb', line 6 def attributes data = {} if scope scope.split(",").each do |field| next unless whitelist_attributes.include?(field.to_sym) data[field.to_sym] = object.send(field.to_sym) end end data[:child_ids] = object.send(:child_ids) data end |