sunstone 1.7.2 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 108946b9f68b607bdd02fd5516fe3d245c38ef50
4
- data.tar.gz: ac1fc9a9862fe8b09441952c0ccc24de41911405
3
+ metadata.gz: b44a6ab0552422a1de963d6267dcc94207dfddfa
4
+ data.tar.gz: 029a94fcf264826256eb1374de107348ad802e1f
5
5
  SHA512:
6
- metadata.gz: e7478ab403ba72b0c282846be4527bc008f43047fa400428b1038ed0b0a4663303ce1a20a4381f2cefc7d200a69283bfb7944b08b4113691c48d6037bd46dfbc
7
- data.tar.gz: 50a43596ea7ece5765415151f1cf721858c99f3a2b1ac39fd7d780852a97bbafa923ec598f304f6b6723f63bacd6fc5ab7f7e8f15b818a2c0a63ca4cb3bec700
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
@@ -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 = 0.1
28
+ VERSION = '1.7.5'
28
29
 
29
30
  # TODO:
30
31
  #
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "sunstone"
3
- s.version = '1.7.2'
3
+ s.version = '1.7.5'
4
4
  s.authors = ["Jon Bracy"]
5
5
  s.email = ["jonbracy@gmail.com"]
6
6
  s.homepage = "http://sunstonerb.com"
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.2
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-02-11 00:00:00.000000000 Z
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