lib/meibo/organization.rb in meibo-0.14.0 vs lib/meibo/organization.rb in meibo-0.15.0
- old
+ new
@@ -39,10 +39,14 @@
@identifier = identifier
@parent_sourced_id = parent_sourced_id
@extension_fields = extension_fields
end
+ def collection
+ Meibo.current_roster.organizations
+ end
+
def department?
type == TYPES[:department]
end
def school?
@@ -64,10 +68,14 @@
def national?
type == TYPES[:national]
end
def parent
- parent_sourced_id && Meibo.current_roster.organizations.find(parent_sourced_id)
+ parent_sourced_id && collection.find(parent_sourced_id)
+ end
+
+ def children
+ collection.where(parent_sourced_id: sourced_id)
end
def enrollments
Meibo.current_roster.enrollments.where(school_sourced_id: sourced_id)
end