Class: Goldencobra::ArticleCustomSerializer

Inherits:
ArticleSerializer
  • Object
show all
Defined in:
app/serializers/goldencobra/article_custom_serializer.rb

Instance Method Summary collapse

Methods inherited from ArticleSerializer

#metatags, #widgets

Instance Method Details

#attributesObject

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