Could you sort this list before building the items array, and avoid the sort on line 199?
deployment.activations.sort do |activation|
...
end