Sha256: 237ea18c0e76c8053219c11bb6c8fe3e6d83683df59d4f1d7665faa2f574d7f0
Contents?: true
Size: 645 Bytes
Versions: 5
Compression:
Stored size: 645 Bytes
Contents
module BetterAr module Calculations # Does a count on the query # # example: # User.count(:age => 20) # # is the same as: # User.where(:age => 20).count # # if the key :conditions is present it will fall back to legacy # # @param [Hash] # Optional follows same convention as {#all} # @return [Integer] def count(opts = {}, extra = {}) if opts.nil? || opts.empty? super(nil, extra) elsif opts.key?(:conditions) super(opts, extra) else all(opts).count end end end end ActiveRecord::Relation.send(:include, BetterAr::Calculations)
Version data entries
5 entries across 5 versions & 1 rubygems