left_joins 1.0.2 → 1.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: 7e53341751b336f45518a17f999a01edce0a82e2
4
- data.tar.gz: d846380c736ba9b8c6e08a3f354b8b2cb23b0dcc
3
+ metadata.gz: 33da27b6e6da1cea9aed88c993c7ab327f831331
4
+ data.tar.gz: dc0cf372cf8c4fb4d551e8710ad99ade145faae1
5
5
  SHA512:
6
- metadata.gz: e84494efa9cb604ca6f03499e009b186a3e3d936e7824f403026dcf9faecb25a6a7b64ec6277a19b06328cc9751e4649e0f80f90d20899174e15dc409493695a
7
- data.tar.gz: 819bfefd4723df868dcfc2f038ed12b1772453f3c9ecded4991fb702f29c4a148e27c78415eefde05c64068729fabfa35319dc6783bf0c4ebc2ce3aa57e98cc4
6
+ metadata.gz: 5814d112df40ef96bface633fa7493cc69144eb6830a4c1d26be820a318abed1bbadfe216d2b2fbd3328cf42eac9a15e3e3e8013c7ebbb42577b36206a3f84b9
7
+ data.tar.gz: 809e8b6174b80093671bd7cdee59e996423a229777968da0711cddfd7d5b1f55008dd5b1fe4d8bfdbd1cb4c93bdc850d7295779ca527154bc41dbec8a8919a9e
@@ -10,11 +10,14 @@ before_install:
10
10
  - gem --version
11
11
  gemfile:
12
12
  - gemfiles/3.2.gemfile
13
+ - gemfiles/4.0.gemfile
13
14
  - gemfiles/4.2.gemfile
14
15
  - gemfiles/5.0.gemfile
16
+ - gemfiles/5.1.gemfile
17
+ - gemfiles/5.2.gemfile
15
18
  addons:
16
19
  code_climate:
17
- repo_token: 4be4fd5792acf886a179e8ebff97d155dc19858816d7179f2bf5002bae874818
20
+ repo_token: 9f3ed69eaf4cd5087f34c19d2e74f2457cdd1ae031cc43d0c1be308675e95823
18
21
  after_success:
19
22
  - bundle exec codeclimate-test-reporter
20
23
 
@@ -0,0 +1,10 @@
1
+ ## Change Log
2
+
3
+ ### v1.0.2 2018/01/12
4
+ - [#3](https://github.com/khiav223577/left_joins/pull/3) fix missing left joins when using in association condition (@khiav223577)
5
+
6
+ ### v1.0.1 2017/12/25
7
+ - [#2](https://github.com/khiav223577/left_joins/pull/2) Fix count which would sometimes force a DISTINCT (@khiav223577)
8
+
9
+ ### v1.0.0 2017/12/25
10
+ - [#1](https://github.com/khiav223577/left_joins/pull/1) implement left joins (@khiav223577)
@@ -1,8 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rails_or.gemspec
4
-
5
- gem "activerecord", "~> 3.2"
3
+ gem "activerecord", "~> 3.2.0"
6
4
 
7
5
  group :test do
8
6
  gem "simplecov"
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 4.0.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ end
9
+
10
+ gemspec :path => "../"
11
+
@@ -1,8 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rails_or.gemspec
4
-
5
- gem "activerecord", "~> 4.2"
3
+ gem "activerecord", "~> 4.2.0"
6
4
 
7
5
  group :test do
8
6
  gem "simplecov"
@@ -1,8 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rails_or.gemspec
4
-
5
- gem "activerecord", "~> 5.0"
3
+ gem "activerecord", "~> 5.0.0"
6
4
 
7
5
  group :test do
8
6
  gem "simplecov"
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 5.1.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ end
9
+
10
+ gemspec :path => "../"
11
+
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 5.2.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ end
9
+
10
+ gemspec :path => "../"
11
+
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "~> 1.11"
31
31
  spec.add_development_dependency "rake", "~> 12.0"
32
32
  spec.add_development_dependency "sqlite3", "~> 1.3"
33
- spec.add_development_dependency "minitest", "~> 5.0"
34
- spec.add_development_dependency "pluck_all", ">= 1.2.3"
33
+ spec.add_development_dependency "minitest", ">= 4.2"
34
+ spec.add_development_dependency "pluck_all", ">= 2.0.2"
35
35
 
36
36
  spec.add_dependency "activerecord", ">= 3"
37
37
 
@@ -4,20 +4,10 @@ require 'active_record/relation'
4
4
 
5
5
  module LeftJoins
6
6
  IS_RAILS3_FLAG = Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
7
+ require 'left_joins_for_rails_3' if IS_RAILS3_FLAG
7
8
  end
8
9
 
9
10
  module ActiveRecord::QueryMethods
10
-
11
- # ----------------------------------------------------------------
12
- # ● Implement check_if_method_has_arguments! method for Rails 3
13
- # ----------------------------------------------------------------
14
- if LeftJoins::IS_RAILS3_FLAG
15
- def check_if_method_has_arguments!(method_name, args)
16
- if args.blank?
17
- raise ArgumentError, "The method .#{method_name}() must contain arguments."
18
- end
19
- end
20
- end
21
11
  if not method_defined?(:left_outer_joins!)
22
12
  # ----------------------------------------------------------------
23
13
  # ● Storing left joins values into @left_outer_joins_values
@@ -69,18 +59,18 @@ module ActiveRecord::QueryMethods
69
59
  end
70
60
 
71
61
  class ::ActiveRecord::Associations::JoinDependency
72
- if LeftJoins::IS_RAILS3_FLAG
73
- alias_method :build_without_hooking_join_type, :build
74
- def build(associations, parent = nil, join_type = Arel::Nodes::InnerJoin)
75
- join_type = Thread.current.thread_variable_get :left_joins_join_type || join_type
76
- return build_without_hooking_join_type(associations, parent, join_type)
77
- end
78
- else
62
+ if private_method_defined?(:make_constraints)
79
63
  alias_method :make_constraints_without_hooking_join_type, :make_constraints
80
64
  def make_constraints(*args, join_type)
81
65
  join_type = Thread.current.thread_variable_get :left_joins_join_type || join_type
82
66
  return make_constraints_without_hooking_join_type(*args, join_type)
83
67
  end
68
+ else
69
+ alias_method :build_without_hooking_join_type, :build
70
+ def build(associations, parent = nil, join_type = Arel::Nodes::InnerJoin)
71
+ join_type = Thread.current.thread_variable_get :left_joins_join_type || join_type
72
+ return build_without_hooking_join_type(associations, parent, join_type)
73
+ end
84
74
  end
85
75
  end
86
76
 
@@ -90,7 +80,7 @@ module ActiveRecord::QueryMethods
90
80
 
91
81
  # If #count is used with #distinct (i.e. `relation.distinct.count`) it is
92
82
  # considered distinct.
93
- distinct = LeftJoins::IS_RAILS3_FLAG ? options[:distinct] || self.uniq_value : self.distinct_value
83
+ distinct = options[:distinct] || self.distinct_value
94
84
 
95
85
  if operation == "count"
96
86
  column_name ||= select_for_count
@@ -1,3 +1,3 @@
1
1
  module LeftJoins
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -0,0 +1,16 @@
1
+ # ----------------------------------------------------------------
2
+ # ● Implement check_if_method_has_arguments! method for Rails 3
3
+ # ----------------------------------------------------------------
4
+ module ActiveRecord::QueryMethods
5
+ def check_if_method_has_arguments!(method_name, args)
6
+ if args.blank?
7
+ raise ArgumentError, "The method .#{method_name}() must contain arguments."
8
+ end
9
+ end
10
+ end
11
+
12
+ module ActiveRecord::Calculations
13
+ def distinct_value
14
+ uniq_value
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: left_joins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - khiav reoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2018-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,30 +56,30 @@ dependencies:
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '5.0'
61
+ version: '4.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '5.0'
68
+ version: '4.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pluck_all
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.2.3
75
+ version: 2.0.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.2.3
82
+ version: 2.0.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activerecord
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - ".travis.yml"
106
+ - CHANGELOG.md
106
107
  - CODE_OF_CONDUCT.md
107
108
  - Gemfile
108
109
  - LICENSE.txt
@@ -111,11 +112,15 @@ files:
111
112
  - bin/console
112
113
  - bin/setup
113
114
  - gemfiles/3.2.gemfile
115
+ - gemfiles/4.0.gemfile
114
116
  - gemfiles/4.2.gemfile
115
117
  - gemfiles/5.0.gemfile
118
+ - gemfiles/5.1.gemfile
119
+ - gemfiles/5.2.gemfile
116
120
  - left_joins.gemspec
117
121
  - lib/left_joins.rb
118
122
  - lib/left_joins/version.rb
123
+ - lib/left_joins_for_rails_3.rb
119
124
  homepage: https://github.com/khiav223577/left_joins
120
125
  licenses:
121
126
  - MIT