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