Class: Tagging::RemoveTagSpecialSectionWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- Tagging::RemoveTagSpecialSectionWorker
- Defined in:
- app/workers/tagging/remove_tag_special_section_worker.rb
Overview
This worker is responsible for removing a specific tag (tag id: 756) from a restaurant or group of restaurants and refreshing the view cache key of the affected restaurants. related to app/workers/tagging/update_special_section_worker.rb
Instance Method Summary collapse
Methods inherited from ApplicationWorker
Instance Method Details
#perform(compact_restaurant_id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/workers/tagging/remove_tag_special_section_worker.rb', line 6 def perform(compact_restaurant_id) restaurant_tag = RestaurantTag.find_by(id: 756) return if restaurant_tag.blank? compact_restaurant = CompactRestaurant.find compact_restaurant_id restaurant_ids = if compact_restaurant.branch compact_restaurant.branch.restaurants.pluck(:id) else compact_restaurant.restaurant_id end = RestaurantTagsRestaurant.where(restaurant_tag_id: restaurant_tag.id, restaurant_id: restaurant_ids) return if .blank? .each do |rtr| rtr.restaurant&.refresh_view_cache_key end .delete_all restaurant_tag.touch end |