app/models/group.rb
def services(year = nil)
    if year.blank?
      Service.joins(:employees => :groups).where(:groups => {:id => self.id}).uniq.order(:name)
    else
      Service.joins(:employees => :groups).where(:groups => {:id => self.id},
          :employee_allocations => {:fiscal_year_id => year.id}).uniq.order(:name)
    end
  end
# Returns a table of services that the employees of the group have. The table is sorted by the
# services' names, and does not contain duplicates. 
Returns a table of services that the employees of the group have. The table is sorted by the
services' names, and does not contain duplicates.
Returns a table of services that the employees of the group have . The table is sorted by the services ' names and does not contain duplicates .
def services(year = nil)
    if year.blank?
      Service.joins(:employees => :groups).where(:groups => {:id => self.id}).uniq.order(:name)
    else
      Service.joins(:employees => :groups).where(:groups => {:id => self.id},
          :employee_allocations => {:fiscal_year_id => year.id}).uniq.order(:name)
    end
  end
def services ( year = nil ) if year . blank? Service . joins ( :employees => :groups ) . where ( :groups => { :id => self . id } ) . uniq . order ( :name ) else Service . joins ( :employees => :groups ) . where ( :groups => { :id => self . id } , :employee_allocations => { :fiscal_year_id => year . id } ) . uniq . order ( :name ) end end
Returns a table of services that the employees of the group have.
Returns a table of services that the employees of the group have .
year