title: Deprecated count in rails 4
body: <pre><code>a = Session.where(:date_at =&gt; date_from..date_to).
              order("date_at").
              count("DISTINCT(user_id)",
                    :group =&gt; "date(convert_tz(date_at, 'UTC', 'Europe/Warsaw'))")
  </code></pre>
  
  <p>How can I write this in Rails 4 ? </p>
  
  <p>This generates error:</p>
  
  <pre><code>DEPRECATION WARNING: Relation#calculate with finder options is deprecated. Please build a scope and then call calculate on it instead. (called from block (2 levels) in &lt;top (required)&gt; at /Users/xxx/Desktop/DEPLOY/d1_mysql/d1/app/admin/user.rb:11)
  DEPRECATION WARNING: The :distinct option for `Relation#count` is deprecated. Please use `Relation#distinct` instead. (eg. `relation.distinct.count`). (called from block (2 levels) in &lt;top (required)&gt; at /Users/xxx/Desktop/DEPLOY/d1_mysql/d1/app/admin/user.rb:11)
  </code></pre>