Update activities_controller.rb

I'm not positive if this is what you want, but you should try to sort things in SQL instead of ruby.