scope:left_joins_milestones,->{joins("LEFT OUTER JOIN milestones ON #{table_name}.milestone_id = milestones.id")}
scope:order_milestone_due_desc,->{left_joins_milestones.reorder(Arel.sql('milestones.due_date IS NULL, milestones.id IS NULL, milestones.due_date DESC'))}
scope:order_milestone_due_asc,->{left_joins_milestones.reorder(Arel.sql('milestones.due_date IS NULL, milestones.id IS NULL, milestones.due_date ASC'))}
scope:without_release,->do
joins("LEFT OUTER JOIN milestone_releases ON #{table_name}.milestone_id = milestone_releases.milestone_id")
.where('milestone_releases.release_id IS NULL')
end
scope:joins_milestone_releases,->do
joins("JOIN milestone_releases ON #{table_name}.milestone_id = milestone_releases.milestone_id