a better approach would be let active record help us, something like:

``` ruby
  val = rates.select_value("count(*) as cnt").where(dimension: dimension, rater_id: user_id)
```