Class: SidebarSectionLinksUpdater
- Inherits:
-
Object
- Object
- SidebarSectionLinksUpdater
- Defined in:
- app/services/sidebar_section_links_updater.rb
Class Method Summary collapse
- .update_category_section_links(user, category_ids:) ⇒ Object
- .update_tag_section_links(user, tag_ids:) ⇒ Object
Class Method Details
.update_category_section_links(user, category_ids:) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/services/sidebar_section_links_updater.rb', line 4 def self.update_category_section_links(user, category_ids:) if category_ids.blank? delete_section_links(user: user, linkable_type: "Category") else category_ids = Category.where(id: category_ids).pluck(:id) category_ids = category_ids[...SidebarSection::MAX_USER_CATEGORY_LINKS] update_section_links(user: user, linkable_type: "Category", new_linkable_ids: category_ids) end end |
.update_tag_section_links(user, tag_ids:) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/services/sidebar_section_links_updater.rb', line 14 def self.update_tag_section_links(user, tag_ids:) if tag_ids.blank? delete_section_links(user: user, linkable_type: "Tag") else update_section_links(user: user, linkable_type: "Tag", new_linkable_ids: tag_ids) end end |