Defect #23318 » issue_nested_set.patch
lib/redmine/nested_set/issue_nested_set.rb | ||
---|---|---|
158 | 158 |
self.class.reorder(:id).where(:root_id => sets_to_lock).lock(lock).ids |
159 | 159 |
else |
160 | 160 |
sets_to_lock = [id, parent_id].compact |
161 |
self.class.reorder(:id).where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).lock.ids |
|
161 |
inner_join_statement = self.class.select(:root_id).where(id: sets_to_lock).distinct(:root_id).to_sql |
|
162 |
self.class.reorder(:id).joins("INNER JOIN (#{inner_join_statement}) as i2 ON #{self.class.table_name}.root_id = i2.root_id").lock.ids |
|
162 | 163 |
end |
163 | 164 |
end |
164 | 165 |