Module: ModelExt::Restaurants::Callbacks

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

Overview

this module contains all callbacks in Restaurant model

Instance Method Summary collapse

Instance Method Details

#bump_inventory_checker_cache_versionsObject



159
160
161
# File 'lib/model_ext/restaurants/callbacks.rb', line 159

def bump_inventory_checker_cache_versions
  create_inv_checkers.each(&:bump_restaurant_cache_key_version)
end

#create_or_update_restaurant_tagsObject



147
148
149
150
151
# File 'lib/model_ext/restaurants/callbacks.rb', line 147

def create_or_update_restaurant_tags
  if lat.present? && lng.present? && is_skip_auto_tag_location.blank?
    Tagging::RestaurantBasedOnGeoWorker.perform_async(id)
  end
end

#refresh_inv_checkerObject



153
154
155
156
157
# File 'lib/model_ext/restaurants/callbacks.rb', line 153

def refresh_inv_checker
  create_inv_checkers.each do |inv_checker|
    inv_checker.delete_old_cache_keys
  end
end

#refresh_view_cache_keyObject



142
143
144
145
# File 'lib/model_ext/restaurants/callbacks.rb', line 142

def refresh_view_cache_key
  Rails.cache.write(view_cache_key_redis_key, Time.zone.now)
  ::Restaurants::SlugWorker.perform_async(id)
end