# If a category is specified, issues are reassigned to this category
def destroy(reassign_to = nil)
if reassign_to && reassign_to.is_a?(IssueCategory) && reassign_to.project == self.project
- Issue.update_all("category_id = #{reassign_to.id}", "category_id = #{id}")
+ Issue.update_all({:category_id => reassign_to.id}, {:category_id => id})
end
destroy_without_reassign
end
def update_messages_board
if board_id_changed?
- Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id])
+ Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id])
Board.reset_counters!(board_id_was)
Board.reset_counters!(board_id)
end
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
# Groups and active users
- scope :active, lambda { where("#{Principal.table_name}.status = 1") }
+ scope :active, lambda { where(:status => STATUS_ACTIVE) }
scope :like, lambda {|q|
q = q.to_s
where("1=0")
else
ids = projects.map(&:id)
- where("#{Principal.table_name}.status = 1 AND #{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids)
+ active.where("#{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids)
end
}
# Principals that are not members of projects