Count unique records in Rails 4

See: https://github.com/charlotte-ruby/impressionist/issues/105