sunstone 1.7.2 → 1.7.5
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 +4 -4
- data/lib/arel/collectors/sunstone.rb +1 -1
- data/lib/ext/active_record/relation/predicate_builder.rb +23 -0
- data/lib/sunstone.rb +2 -1
- data/sunstone.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44a6ab0552422a1de963d6267dcc94207dfddfa
|
4
|
+
data.tar.gz: 029a94fcf264826256eb1374de107348ad802e1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f335ce7adf6a1a74a89329f17a5c800c8869373f692cfaeba6d6301a18c5da28b41927e2e6bff422e7e0a212cb2779bcc72f8db03dad4e503461ec57b878a6d1
|
7
|
+
data.tar.gz: a8ce9395283ba5bb29dc52b1a9eea385627fb1bd6184420d8a37dfc591e012810bd3b30a5d6587d6f660cc94d85771bc20b82f553fa314e3a99af6bdcf086edc
|
@@ -75,7 +75,7 @@ module Arel
|
|
75
75
|
end
|
76
76
|
|
77
77
|
request = request_type.new(path)
|
78
|
-
request.instance_variable_set(:@sunstone_calculation, true) if [:calculate, :update, :delete].include?(operation)
|
78
|
+
request.instance_variable_set(:@sunstone_calculation, true) if [:calculate, :update, :delete, :insert].include?(operation)
|
79
79
|
|
80
80
|
if updates
|
81
81
|
request.body = body
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class PredicateBuilder # :nodoc:
|
3
|
+
|
4
|
+
def self.expand(klass, table, column, value)
|
5
|
+
queries = []
|
6
|
+
|
7
|
+
# In standard Rails where takes :table => { columns }, but in sunstone we
|
8
|
+
# can can do nested tables eg: where(:properties => { :regions => {:id => 1}})
|
9
|
+
if klass && reflection = klass._reflect_on_association(column)
|
10
|
+
if reflection.polymorphic? && base_class = polymorphic_base_class_from_value(value)
|
11
|
+
queries << build(table[reflection.foreign_type], base_class)
|
12
|
+
end
|
13
|
+
|
14
|
+
# column = reflection.foreign_key
|
15
|
+
column # Don't need Rails to assume we are referencing a table
|
16
|
+
end
|
17
|
+
|
18
|
+
queries << build(table[column], value)
|
19
|
+
queries
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/sunstone.rb
CHANGED
@@ -12,6 +12,7 @@ require 'sunstone/connection'
|
|
12
12
|
require 'sunstone/exception'
|
13
13
|
require 'ext/active_record/statement_cache'
|
14
14
|
require 'ext/active_record/relation'
|
15
|
+
require 'ext/active_record/relation/predicate_builder'
|
15
16
|
require 'ext/active_record/calculations'
|
16
17
|
require 'ext/active_record/associations/builder/has_and_belongs_to_many'
|
17
18
|
|
@@ -24,7 +25,7 @@ require 'ext/active_record/batches'
|
|
24
25
|
# require 'sunstone/parser'
|
25
26
|
|
26
27
|
module Sunstone
|
27
|
-
VERSION =
|
28
|
+
VERSION = '1.7.5'
|
28
29
|
|
29
30
|
# TODO:
|
30
31
|
#
|
data/sunstone.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- lib/ext/active_record/calculations.rb
|
274
274
|
- lib/ext/active_record/finder_methods.rb
|
275
275
|
- lib/ext/active_record/relation.rb
|
276
|
+
- lib/ext/active_record/relation/predicate_builder.rb
|
276
277
|
- lib/ext/active_record/statement_cache.rb
|
277
278
|
- lib/ext/arel/nodes/eager_load.rb
|
278
279
|
- lib/ext/arel/nodes/select_statement.rb
|