Class: Goldencobra::UploadSerializer

Inherits:
ActiveModel::Serializer
  • Object
show all
Defined in:
app/serializers/goldencobra/upload_serializer.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject

Includes all defined methods



4
5
6
7
8
9
10
11
12
13
14
# File 'app/serializers/goldencobra/upload_serializer.rb', line 4

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[:upload_url] = object.send(:image_url)
  data
end