Class: SidebarSectionLinksUpdater

Inherits:
Object
  • Object
show all
Defined in:
app/services/sidebar_section_links_updater.rb

Class Method Summary collapse

Class Method Details



4
5
6
7
8
9
10
11
# 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)
    update_section_links(user: user, linkable_type: "Category", new_linkable_ids: category_ids)
  end
end


13
14
15
16
17
18
19
# File 'app/services/sidebar_section_links_updater.rb', line 13

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