    # File lib/active_record/calculations.rb, line 44
          def count(*args)
            options     = {}
            column_name = :all
            # For backwards compatibility, we need to handle both count(conditions=nil, joins=nil) or count(options={}) or count(column_name=:all, options={}).
            if args.size >= 0 && args.size <= 2
              if args.first.is_a?(Hash)
                options     = args.first
              elsif args[1].is_a?(Hash)
                options     = args[1]
                column_name = args.first
              else
                # Handle legacy paramter options: def count(conditions=nil, joins=nil)
                options.merge!(:conditions => args[0]) if args.length > 0
                options.merge!(:joins => args[1])      if args.length > 1
              end
            else
              raise(ArgumentError, "Unexpected parameters passed to count(*args): expected either count(conditions=nil, joins=nil) or count(options={})")
            end

            if options[:include] || scope(:find, :include)
              count_with_associations(options)
            else
              calculate(:count, column_name, options)
            end
          end