app/models/area.rb in voluntary-0.1.0.rc2 vs app/models/area.rb in voluntary-0.1.0.rc3
- old
+ new
@@ -12,8 +12,16 @@
extend FriendlyId
friendly_id :name, :use => :slugged
+ def self.find_by_product_id(product_id)
+ roots.joins(:projects).merge(Project.for_product_id(product_id)).group('areas.id')
+ end
+
+ def children_for_product_id(product_id)
+ children.joins(:projects).merge(Project.for_product_id(product_id)).group('areas.id')
+ end
+
def products
end
end
\ No newline at end of file