calculable_attrs 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc9300a7e0499492982a09b34c989978fed6c09b
4
- data.tar.gz: c635f7b8e3db6594bcbd1a780c1a96738ee281f3
3
+ metadata.gz: 954d47ca697bae820aebb918de5f919b6196c17b
4
+ data.tar.gz: 439f28fcf53f237e7a2d93c216a08f110584e830
5
5
  SHA512:
6
- metadata.gz: 3405f74980918e7621336cb67c3f4d01e12dae5b9579113a3874caeb75e47871dc672502f1a351ce27a673e612dfe792cda00628cf98761b135026a91c4cffcd
7
- data.tar.gz: 5aed3a55144e62bca6a0500a1de8f5f61f69aaa2096059a0911478dddc0ff7c3d97a32449169f8c9cd603a54c677ff930f1d0c273183e4f1fe7d67454d9f78a8
6
+ metadata.gz: cfeb311e114c035366739d280cd716b9cdc1356d8591e2f06e1c9b07c805c360f289330cbea3718cee682f592c493e728570cf9ab5f953f56ba34f9cdc0b6171
7
+ data.tar.gz: cefa24ecd22b704477ae1a56e7e42b81386a2dc6d96afa36d072d6fda62221ddab88cfb7bf27cb1bdbc8116bbb1408b67ffff9e745bece24e8c6daa8155fef10
@@ -25,6 +25,7 @@ module CalculableAttrs::ActiveRecord::Relation
25
25
  def self.included(base)
26
26
  base.class_eval do
27
27
  alias_method :calculable_orig_exec_queries, :exec_queries
28
+ alias_method :calculable_orig_calculate, :calculate
28
29
  def exec_queries
29
30
  if calculable_attrs_joined.empty?
30
31
  calculable_orig_exec_queries
@@ -34,6 +35,15 @@ module CalculableAttrs::ActiveRecord::Relation
34
35
  apped_calculable_attrs
35
36
  @records
36
37
  end
38
+
39
+ def calculate(operation, column_name, options = {})
40
+ if calculable_attrs_joined.empty?
41
+ calculable_orig_calculate(operation,column_name,options)
42
+ else
43
+ relation = wrap_with_calculable_joins(spawn)
44
+ relation.calculable_orig_calculate(operation,column_name,options)
45
+ end
46
+ end
37
47
  end
38
48
  end
39
49
 
@@ -1,3 +1,3 @@
1
1
  module CalculableAttrs
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calculable_attrs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Sharkov