Sha256: 9c42abc131310d72960cd8af66892f50f65c714f52f46efb25919e38b712b310

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

class FavouriteObject::LiteFavouriteSerializer < ActiveModel::Serializer
  root :favourite

  attributes :id, :target_id, :target_type, :is_favourited, :third_party_flag

  def target_id
    if self.object.third_party_flag == true
      self.object.third_party_id
    else
      self.object.target_id
    end
  end

  def target_type
    if self.object.third_party_flag == true
      self.object.third_party_type
    else
      self.object.target_type
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
favourite_object-0.1.1 app/serializer/favourite_object/lite_favourite_serializer.rb
favourite_object-0.1.0 app/serializer/favourite_object/lite_favourite_serializer.rb