app/controllers/portfolios_controller.rb
def load_possible_groups
      if can? :manage, :all
        @possible_groups = Group.order(:name)
      else
        @possible_groups = @current_user.admin_groups
      end
      @groups_with_product_group_portfolios = Group.where("groups.id IN (?)", @possible_groups.pluck(:id) ).includes(:product_group_portfolios => :product).where(:product_group_portfolios => {:portfolio_id => @portfolio.id}).order("groups.name", "products.name").uniq
    end
# Loads all groups that the current user can edit, along with any allocations that those 
# may have
Loads all groups that the current user can edit, along with any allocations that those
may have
Loads all groups that the current user can edit along with any allocations that those may have
def load_possible_groups
      if can? :manage, :all
        @possible_groups = Group.order(:name)
      else
        @possible_groups = @current_user.admin_groups
      end
      @groups_with_product_group_portfolios = Group.where("groups.id IN (?)", @possible_groups.pluck(:id) ).includes(:product_group_portfolios => :product).where(:product_group_portfolios => {:portfolio_id => @portfolio.id}).order("groups.name", "products.name").uniq
    end
def load_possible_groups if can? :manage , :all @possible_groups = Group . order ( :name ) else @possible_groups = @current_user . admin_groups end @groups_with_product_group_portfolios = Group . where ( "groups.id IN (?)" , @possible_groups . pluck ( :id ) ) . includes ( :product_group_portfolios => :product ) . where ( :product_group_portfolios => { :portfolio_id => @portfolio . id } ) . order ( "groups.name" , "products.name" ) . uniq end
Loads all groups that the current user can edit, along with any allocations that those
may have
Loads all groups that the current user can edit along with any allocations that those may have