Module: ModelExt::Restaurants::Relations

Extended by:
ActiveSupport::Concern
Included in:
Restaurant
Defined in:
lib/model_ext/restaurants/relations.rb

Overview

Responsible for managing relations of Restaurant model

Instance Method Summary collapse

Instance Method Details

#award_badge_tagsActiveRecord::Relation

Returns the award badge tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the award badge tags



327
328
329
# File 'lib/model_ext/restaurants/relations.rb', line 327

def award_badge_tags
  restaurant_tags_by_category(RestaurantTag::AWARD_BADGE)
end

#award_type_tagsActiveRecord::Relation

Returns the award type tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the award type tags



334
335
336
# File 'lib/model_ext/restaurants/relations.rb', line 334

def award_type_tags
  restaurant_tags_by_category(RestaurantTag::AWARD_TYPE)
end

#bts_route_tagsActiveRecord::Relation

Returns the BTS route tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the BTS route tags



306
307
308
# File 'lib/model_ext/restaurants/relations.rb', line 306

def bts_route_tags
  restaurant_tags_by_category(RestaurantTag::BTS_ROUTE)
end

#cuisine_tagsActiveRecord::Relation

Returns the cuisine tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the cuisine tags



271
272
273
# File 'lib/model_ext/restaurants/relations.rb', line 271

def cuisine_tags
  restaurant_tags_by_category(RestaurantTag::CUISINE)
end

#dining_style_tagsActiveRecord::Relation

Returns the dining style tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the dining style tags



285
286
287
# File 'lib/model_ext/restaurants/relations.rb', line 285

def dining_style_tags
  restaurant_tags_by_category(RestaurantTag::DINING_STYLE)
end

#facility_tagsActiveRecord::Relation

Returns the facility tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the facility tags



320
321
322
# File 'lib/model_ext/restaurants/relations.rb', line 320

def facility_tags
  restaurant_tags_by_category(RestaurantTag::FACILITY)
end

#fetch_restaurant_tagsObject



255
256
257
258
259
# File 'lib/model_ext/restaurants/relations.rb', line 255

def fetch_restaurant_tags
  ::Rails.cache.fetch "#{cache_key}/restaurant_tags" do
    restaurant_tags
  end
end

#hashtag_tagsActiveRecord::Relation

Returns the hashtag tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the hashtag tags



264
265
266
# File 'lib/model_ext/restaurants/relations.rb', line 264

def hashtag_tags
  restaurant_tags_by_category(RestaurantTag::HASHTAGS)
end

#location_tagsActiveRecord::Relation

Returns the location tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the location tags



278
279
280
# File 'lib/model_ext/restaurants/relations.rb', line 278

def location_tags
  restaurant_tags_by_category(RestaurantTag::LOCATION)
end

#mrt_route_tagsActiveRecord::Relation

Returns the MRT route tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the MRT route tags



313
314
315
# File 'lib/model_ext/restaurants/relations.rb', line 313

def mrt_route_tags
  restaurant_tags_by_category(RestaurantTag::MRT_ROUTE)
end

Returns the popular zone tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the popular zone tags



292
293
294
# File 'lib/model_ext/restaurants/relations.rb', line 292

def popular_zone_tags
  restaurant_tags_by_category(RestaurantTag::POPULAR_ZONE)
end

#shopping_mall_tagsActiveRecord::Relation

Returns the shopping mall tags for the restaurant.

Returns:

  • (ActiveRecord::Relation)

    the shopping mall tags



299
300
301
# File 'lib/model_ext/restaurants/relations.rb', line 299

def shopping_mall_tags
  restaurant_tags_by_category(RestaurantTag::SHOPPING_MALL)
end