app/models/area.rb in voluntary-0.4.0 vs app/models/area.rb in voluntary-0.5.0
- old
+ new
@@ -12,11 +12,11 @@
OR areas2.ancestry like CONCAT('%', '/', areas.id)
OR areas2.ancestry like CONCAT('%', '/', areas.id, '/', '%')
OR areas2.ancestry = CONCAT(areas.id, '')
LEFT JOIN areas_projects ON areas_projects.area_id = areas2.id
LEFT JOIN projects ON projects.id = areas_projects.project_id
- }).where('areas2.id IS NOT NULL AND projects.product_id = ?', product_id)
+ }).where('areas2.id IS NOT NULL AND projects.product_id = ?', product_id == 'no-name' ? '' : product_id)
end
validates :name, presence: true, uniqueness: true
attr_accessible :name, :parent_id
@@ -24,10 +24,9 @@
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))
roots.with_projects_for_product(product_id)
end
def children_for_product_id(product_id)
#children.joins(:projects).merge(Project.for_product_id(product_id))
\ No newline at end of file