Sha256: 9000db2666aaac91f762ef6c81333ed25b74ccfc15b81cc03f3461b97b89c9ab
Contents?: true
Size: 452 Bytes
Versions: 4
Compression:
Stored size: 452 Bytes
Contents
require "active_support/concern" module Groupdate module Relation extend ActiveSupport::Concern included do attr_accessor :groupdate_values end def calculate(*args, &block) # prevent calculate from being called twice return super if has_include?(args[1]) default_value = [:count, :sum].include?(args[0]) ? 0 : nil Groupdate.process_result(self, super, default_value: default_value) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
groupdate-6.5.1 | lib/groupdate/relation.rb |
groupdate-6.5.0 | lib/groupdate/relation.rb |
groupdate-6.4.0 | lib/groupdate/relation.rb |
groupdate-6.3.0 | lib/groupdate/relation.rb |