Class: RestaurantCpt::Serializers::TagGroupSerializer

Inherits:
ApplicationSerializer show all
Includes:
ActionView::Helpers::AssetUrlHelper
Defined in:
app/concepts/restaurant_cpt/serializers/tag_group_serializer.rb

Instance Method Summary collapse

Methods inherited from ApplicationSerializer

decorate_attributes, decorator, #object_cache_key

Instance Method Details

#cover_urlObject



14
15
16
# File 'app/concepts/restaurant_cpt/serializers/tag_group_serializer.rb', line 14

def cover_url
  asset_url(object.localized_photo_url) if object.localized_photo.present?
end


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/concepts/restaurant_cpt/serializers/tag_group_serializer.rb', line 18

def link
  old_link = search_restaurants_path(date: Date.tomorrow,
                                     start_time: '19:00',
                                     adult: 2,
                                     kids: 0,
                                     'group_tags[]': object.id,
                                     locale: MyLocaleManager.normalize_locale,
                                     format: :html)

  group = GroupLandingPage.find_by(group: object)
  if group.present?
    "#{AdminSetting.web_v2_host}/restaurants/group/#{group.friendly_id}?locale=#{MyLocaleManager.normalize_locale}"
  else
    old_link
  end
end

#total_restaurantsObject



10
11
12
# File 'app/concepts/restaurant_cpt/serializers/tag_group_serializer.rb', line 10

def total_restaurants
  object.restaurants.size
end