aggregate_columns 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/aggregate_columns.rb +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ PKG_FILES = FileList[
|
|
14
14
|
|
15
15
|
spec = Gem::Specification.new do |s|
|
16
16
|
s.name = "aggregate_columns"
|
17
|
-
s.version = "0.9.
|
17
|
+
s.version = "0.9.3"
|
18
18
|
s.author = "Marek Janukowicz"
|
19
19
|
s.email = "marek@janukowicz.net"
|
20
20
|
s.homepage = "http://www.bitbucket.org/starware/aggregate_columns"
|
data/lib/aggregate_columns.rb
CHANGED
@@ -47,7 +47,7 @@ module AggregateColumns
|
|
47
47
|
|
48
48
|
module MethodsRails3
|
49
49
|
|
50
|
-
def
|
50
|
+
def aggregate_columns( options )
|
51
51
|
rel = self.select( "#{table_name}.*" )
|
52
52
|
# Process options
|
53
53
|
options.assert_valid_keys( :association, :column, :function, :result_column, :join_type )
|
@@ -73,7 +73,7 @@ module AggregateColumns
|
|
73
73
|
klass = assoc_reflection.klass
|
74
74
|
join_type = options[:join_type] || "LEFT" # TODO: check if within allowed values
|
75
75
|
|
76
|
-
aggregate_rel = klass.select( "#{function}(#{field}) AS #{result_column}" ).from( aggregate_table_name ).where( "#{table_name}.id = #{
|
76
|
+
aggregate_rel = klass.select( "#{function}(#{field}) AS #{result_column}" ).from( aggregate_table_name ).where( "#{table_name}.id = #{foreign_key}" )
|
77
77
|
#aggregate_rel = klass.select( "#{foreign_key}, #{function}(#{field}) AS #{result_column}" ).from( aggregate_table_name ).group( foreign_key )
|
78
78
|
aggregate_rel = yield( aggregate_rel ) if block_given?
|
79
79
|
rel = rel.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aggregate_columns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 3
|
10
|
+
version: 0.9.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marek Janukowicz
|