Class: Goldencobra::ArticleSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- Goldencobra::ArticleSerializer
- Defined in:
- app/serializers/goldencobra/article_serializer.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#attributes ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/serializers/goldencobra/article_serializer.rb', line 5 def attributes data = super Goldencobra::Article.attribute_names.map(&:to_sym).each do |attr| data[attr] = object.send(attr) end data[:child_ids] = object.send(:child_ids) data end |
#metatags ⇒ Object
18 19 20 |
# File 'app/serializers/goldencobra/article_serializer.rb', line 18 def object..select([:id, :name, :value]) end |
#widgets ⇒ Object
22 23 24 |
# File 'app/serializers/goldencobra/article_serializer.rb', line 22 def object..pluck(:id) end |