Class: FavouriteObject::FavouriteSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- FavouriteObject::FavouriteSerializer
- Defined in:
- app/serializer/favourite_object/favourite_serializer.rb
Instance Method Summary collapse
- #data ⇒ Object
- #description ⇒ Object
-
#include_target? ⇒ Boolean
has_one :target, polymorphic: true.
- #target_id ⇒ Object
- #target_type ⇒ Object
Instance Method Details
#data ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/serializer/favourite_object/favourite_serializer.rb', line 18 def data if self.object.third_party_flag == true self.object.params else [] end end |
#description ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/serializer/favourite_object/favourite_serializer.rb', line 10 def description if self.object.third_party_flag == true self.object.params[:description] else self.object. end end |
#include_target? ⇒ Boolean
has_one :target, polymorphic: true
6 7 8 |
# File 'app/serializer/favourite_object/favourite_serializer.rb', line 6 def include_target? (self.object.third_party_flag != true) end |
#target_id ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/serializer/favourite_object/favourite_serializer.rb', line 26 def target_id if self.object.third_party_flag == true self.object.third_party_id else self.object.target_id end end |
#target_type ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/serializer/favourite_object/favourite_serializer.rb', line 34 def target_type if self.object.third_party_flag == true self.object.third_party_type else self.object.target_type end end |