activerecord-oracle_enhanced-adapter-monky_patch_755 0.0.2 → 0.0.3

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: ed89ee64009f82b6c3b85f576106cb71306205bb
4
- data.tar.gz: 728b4e6b58c2d5d1f1a66a5dcb6f2bcbbd254fdc
3
+ metadata.gz: 0a0c559f94c59c569eb24be966079815ee59926e
4
+ data.tar.gz: 509fdb2ae14da698151a5d9d7c13ad16e551e662
5
5
  SHA512:
6
- metadata.gz: c81a4a2330511a1c98fe65e88c43ef318cdca1642944e91c1fe3ae6c98d241580d4c1806016462c0cf727c61f4c591b35b7c2af3954c41a40a29f291001ea5f4
7
- data.tar.gz: b05a4425652fe1751528fd3c802e1c8ade6d3e1f98d8379cabd52c100ffe37713371b0121a73171ae99e228329289a2ba129ac6b9215b90991876ce919821fa0
6
+ metadata.gz: 1ffe403b46c1b0504d94dda327489a55b6148da4babbfddbf5ab3fd8e0c70bd68fc1f34549c8a93b7ded8eb22b583ab738caee59c36273d8b66bf0926f750f96
7
+ data.tar.gz: d65c7cd75f69a82f20e835627b75ab4d4a5cb5d7a376a5598b6e01a3f22887e2fd7c889bc6d6bfa60d072fb26228787d1b92209a5cca8a02d7db8c687b0d9373
data/README.md CHANGED
@@ -24,7 +24,7 @@ $ gem install activerecord-oracle_enhanced-adapter-monky_patch_755
24
24
 
25
25
  ## Target
26
26
 
27
- * 'activerecord', '~>4.2.1'
27
+ * 'activerecord', '~>4.2.1', '<=4.2.7'
28
28
  * 'activerecord-oracle_enhanced-adapter', '~> 1.6.0'
29
29
 
30
30
  ## Motivation
@@ -2,6 +2,7 @@ module OracleEnhanced
2
2
  class MonkeyPatch755Railtie < ::Rails::Railtie
3
3
  ActiveSupport.on_load(:active_record) do
4
4
  require 'activerecord/monkey_patch'
5
+ require 'activerecord/monkey_patch/rails4'
5
6
  end
6
7
  end
7
8
  end
@@ -5,9 +5,6 @@
5
5
  #
6
6
  module ActiveRecord
7
7
  module MonkeyPatch
8
- MINIMUM_SUPPORTED_VERSION = '4.2.1'.freeze
9
- MAXIMUM_SUPPORTED_VERSION = '4.2.7'.freeze
10
-
11
8
  def adjust_timezone_offset(opts)
12
9
  if ActiveRecord::Base.connection_config[:adapter] != 'oracle_enhanced' ||
13
10
  Gem::Version.create(Rails.version) < Gem::Version.create(MINIMUM_SUPPORTED_VERSION) ||
@@ -43,48 +40,4 @@ module ActiveRecord
43
40
 
44
41
  module_function :adjust_timezone_offset
45
42
  end
46
-
47
- #
48
- # Original code is the following URL.
49
- #
50
- # https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/relation/query_methods.rb#L947
51
- #
52
- module QueryMethods
53
- def build_where(opts, other = [])
54
- case opts
55
- when String, Array
56
- [@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
57
- when Hash
58
- opts = ActiveRecord::MonkeyPatch.adjust_timezone_offset(opts)
59
- opts = PredicateBuilder.resolve_column_aliases(klass, opts)
60
-
61
- tmp_opts, bind_values = create_binds(opts)
62
- self.bind_values += bind_values
63
-
64
- attributes = @klass.send(:expand_hash_conditions_for_aggregates, tmp_opts)
65
- add_relations_to_bind_values(attributes)
66
-
67
- PredicateBuilder.build_from_hash(klass, attributes, table)
68
- else
69
- [opts]
70
- end
71
- end
72
- end
73
-
74
- #
75
- # Original code is the following URL.
76
- #
77
- # https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/statement_cache.rb#L81
78
- #
79
- class StatementCache # :nodoc:
80
- class BindMap # :nodoc:
81
- def bind(values)
82
- values = ActiveRecord::MonkeyPatch.adjust_timezone_offset(values)
83
-
84
- bvs = @bind_values.map { |pair| pair.dup }
85
- @indexes.each_with_index { |offset,i| bvs[offset][1] = values[i] }
86
- bvs
87
- end
88
- end
89
- end
90
43
  end
@@ -0,0 +1,50 @@
1
+ module ActiveRecord
2
+ module MonkeyPatch
3
+ MINIMUM_SUPPORTED_VERSION = '4.2.1'.freeze
4
+ MAXIMUM_SUPPORTED_VERSION = '4.2.7.1'.freeze
5
+ end
6
+
7
+ #
8
+ # Original code is the following URL.
9
+ #
10
+ # https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/relation/query_methods.rb#L947
11
+ #
12
+ module QueryMethods
13
+ def build_where(opts, other = [])
14
+ case opts
15
+ when String, Array
16
+ [@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
17
+ when Hash
18
+ opts = ActiveRecord::MonkeyPatch.adjust_timezone_offset(opts)
19
+ opts = PredicateBuilder.resolve_column_aliases(klass, opts)
20
+
21
+ tmp_opts, bind_values = create_binds(opts)
22
+ self.bind_values += bind_values
23
+
24
+ attributes = @klass.send(:expand_hash_conditions_for_aggregates, tmp_opts)
25
+ add_relations_to_bind_values(attributes)
26
+
27
+ PredicateBuilder.build_from_hash(klass, attributes, table)
28
+ else
29
+ [opts]
30
+ end
31
+ end
32
+ end
33
+
34
+ #
35
+ # Original code is the following URL.
36
+ #
37
+ # https://github.com/rails/rails/blob/v4.2.6/activerecord/lib/active_record/statement_cache.rb#L81
38
+ #
39
+ class StatementCache # :nodoc:
40
+ class BindMap # :nodoc:
41
+ def bind(values)
42
+ values = ActiveRecord::MonkeyPatch.adjust_timezone_offset(values)
43
+
44
+ bvs = @bind_values.map { |pair| pair.dup }
45
+ @indexes.each_with_index { |offset,i| bvs[offset][1] = values[i] }
46
+ bvs
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module MonkeyPatch
3
- VERSION = '0.0.2'.freeze
3
+ VERSION = '0.0.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-oracle_enhanced-adapter-monky_patch_755
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi ITO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 4.2.1
20
20
  - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.2.7
22
+ version: 4.2.7.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 4.2.1
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.2.7
32
+ version: 4.2.7.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activerecord-oracle_enhanced-adapter
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,7 @@ files:
68
68
  - README.md
69
69
  - lib/activerecord-oracle_enhanced-adapter-monky_patch_755.rb
70
70
  - lib/activerecord/monkey_patch.rb
71
+ - lib/activerecord/monkey_patch/rails4.rb
71
72
  - lib/activerecord/monkey_patch/version.rb
72
73
  homepage: http://github.com/koic/oracle-enhanced-monky_patch_755
73
74
  licenses: