From: Tom Hughes Date: Sun, 29 Sep 2013 21:33:04 +0000 (+0100) Subject: Convert trace counting to use modern arel methods X-Git-Tag: live~4685 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/63100ae8a0f0ac810355ffb9578c8b5d1641a8d0 Convert trace counting to use modern arel methods --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index db86684a4..9d0e05530 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -122,8 +122,8 @@ class TraceController < ApplicationController logger.info("id is #{@trace.id}") flash[:notice] = t 'trace.create.trace_uploaded' - if @user.traces.count(:conditions => { :inserted => false }) > 4 - flash[:warning] = t 'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => { :inserted => false }) + if @user.traces.where(:inserted => false).count > 4 + flash[:warning] = t 'trace.trace_header.traces_waiting', :count => @user.traces.where(:inserted => false).count end redirect_to :action => :list, :display_name => @user.display_name