Sha256: d835d4aea957e9f6b1eef58b725f2bc7b987f6522a83aaf93dd97bbce2da4976
Contents?: true
Size: 735 Bytes
Versions: 1
Compression:
Stored size: 735 Bytes
Contents
module Iconly class ProjectIcon < ApplicationRecord belongs_to :project, class_name: 'Project' belongs_to :icon, class_name: 'Icon' def self.all_projects(user_id, term = nil) user_projects = Project.owned_by(user_id) icons = includes(:icon, :project) .joins(:icon, :project) .merge(user_projects) icons = icons.merge(Icon.search(term)) if term.present? project_icons = icons .order('iconly_projects.name') .group_by(&:project) if term.blank? projects_without_icons = user_projects.without_icons projects_without_icons.each { |p| project_icons[p] = [] } end project_icons end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iconly-1.0.0 | app/models/iconly/project_icon.rb |