left_joins 1.0.6 → 1.0.7

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
- SHA256:
3
- metadata.gz: 6110dc9b1424da69502db597837daca734b0b498be812bc6af4e86661bdee4bd
4
- data.tar.gz: 6d62196f6ec5b138cfa098049040b230319b9a2e0bb814e8e6474b36a701a1cb
2
+ SHA1:
3
+ metadata.gz: ec2033d0f2d52843771477d957bd0033a0ce9871
4
+ data.tar.gz: 74120203c3dd31a28b9622585b9bae16b5993ab6
5
5
  SHA512:
6
- metadata.gz: f2326bf1bda17f3713f38dd6535b58683dce063da97e09add2cc42958b835e2f41dad6a83922799f0f79c442b7b938228ed72f90bca5019f79cf0aa117d09ebe
7
- data.tar.gz: 8f9c9a008fbd944402809d90c1b523fbdb2ed5c516af5f612c7fa14a519f6d2c67248137e659bd07c60291fa1af0eb3551fb575349cded0326a3f95683edca18
6
+ metadata.gz: 10c48e27f9e0f2bc35fb04077d1d470268d2b2405af120cee090870466953d170e0c5f70376f150f96cca66e8499c21a3f74d6d3b05e40b3640950b4ba2bce09
7
+ data.tar.gz: cdcc7b9a4ab4b579131354b8ef7abf9e0750927b5c7778d33167526c9cbae5eaa73ed946ab195fcbfdb6c65f77f1deb04749e13314d3bc19bd4a5b661ad2c73c
data/.gitignore CHANGED
@@ -1,9 +1,9 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -1,23 +1,23 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - 2.3
5
- sudo: required
6
- dist: trusty
7
- before_install:
8
- - gem i rubygems-update -v '<3' && update_rubygems
9
- - gem install bundler -v 1.17.3
10
- - gem --version
11
- gemfile:
12
- - gemfiles/3.2.gemfile
13
- - gemfiles/4.0.gemfile
14
- - gemfiles/4.2.gemfile
15
- - gemfiles/5.0.gemfile
16
- - gemfiles/5.1.gemfile
17
- - gemfiles/5.2.gemfile
18
- addons:
19
- code_climate:
20
- repo_token: 9f3ed69eaf4cd5087f34c19d2e74f2457cdd1ae031cc43d0c1be308675e95823
21
- after_success:
22
- - bundle exec codeclimate-test-reporter
23
-
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.3
5
+ sudo: required
6
+ dist: trusty
7
+ before_install:
8
+ - gem i rubygems-update -v '<3' && update_rubygems
9
+ - gem install bundler -v 1.17.3
10
+ - gem --version
11
+ gemfile:
12
+ - gemfiles/3.2.gemfile
13
+ - gemfiles/4.0.gemfile
14
+ - gemfiles/4.2.gemfile
15
+ - gemfiles/5.0.gemfile
16
+ - gemfiles/5.1.gemfile
17
+ - gemfiles/5.2.gemfile
18
+ addons:
19
+ code_climate:
20
+ repo_token: 9f3ed69eaf4cd5087f34c19d2e74f2457cdd1ae031cc43d0c1be308675e95823
21
+ after_success:
22
+ - bundle exec codeclimate-test-reporter
23
+
@@ -1,21 +1,24 @@
1
- ## Change Log
2
-
3
- ### [v1.0.5](https://github.com/khiav223577/left_joins/compare/v1.0.4...v1.0.5) 2019/04/11
4
- - [#9](https://github.com/khiav223577/left_joins/pull/9) left_joins_values should not be nil (@khiav223577)
5
- - [#10](https://github.com/khiav223577/left_joins/pull/10) Lock sqlite3 version to 1.3 (@khiav223577)
6
- - [#8](https://github.com/khiav223577/left_joins/pull/8) Fix: broken test cases after bundler 2.0 was released (@khiav223577)
7
-
8
- ### [v1.0.4](https://github.com/khiav223577/left_joins/compare/v1.0.3...v1.0.4) 2018/07/18
9
- - [#7](https://github.com/khiav223577/left_joins/pull/7) Fix: eager_load is broken (@khiav223577)
10
-
11
- ### [v1.0.3](https://github.com/khiav223577/left_joins/compare/v1.0.2...v1.0.3) 2018/06/30
12
- - [#5](https://github.com/khiav223577/left_joins/pull/5) Fix: JoinDependency#make_constraints is not defined in Rails 4.0 (@khiav223577)
13
-
14
- ### [v1.0.2](https://github.com/khiav223577/left_joins/compare/v1.0.1...v1.0.2) 2018/01/12
15
- - [#3](https://github.com/khiav223577/left_joins/pull/3) fix missing left joins when using in association condition (@khiav223577)
16
-
17
- ### [v1.0.1](https://github.com/khiav223577/left_joins/compare/v1.0.0...v1.0.1) 2017/12/25
18
- - [#2](https://github.com/khiav223577/left_joins/pull/2) Fix count which would sometimes force a DISTINCT (@khiav223577)
19
-
20
- ### [v1.0.0](https://github.com/khiav223577/left_joins/compare/v1.0.0...v1.0.0) 2017/12/25
21
- - [#1](https://github.com/khiav223577/left_joins/pull/1) implement left joins (@khiav223577)
1
+ ## Change Log
2
+
3
+ ### [v1.0.6](https://github.com/khiav223577/left_joins/compare/v1.0.5...v1.0.6) 2019/06/22
4
+ - [#12](https://github.com/khiav223577/left_joins/pull/12) Fix: update with left joins (@khiav223577)
5
+
6
+ ### [v1.0.5](https://github.com/khiav223577/left_joins/compare/v1.0.4...v1.0.5) 2019/04/11
7
+ - [#9](https://github.com/khiav223577/left_joins/pull/9) left_joins_values should not be nil (@khiav223577)
8
+ - [#10](https://github.com/khiav223577/left_joins/pull/10) Lock sqlite3 version to 1.3 (@khiav223577)
9
+ - [#8](https://github.com/khiav223577/left_joins/pull/8) Fix: broken test cases after bundler 2.0 was released (@khiav223577)
10
+
11
+ ### [v1.0.4](https://github.com/khiav223577/left_joins/compare/v1.0.3...v1.0.4) 2018/07/18
12
+ - [#7](https://github.com/khiav223577/left_joins/pull/7) Fix: eager_load is broken (@khiav223577)
13
+
14
+ ### [v1.0.3](https://github.com/khiav223577/left_joins/compare/v1.0.2...v1.0.3) 2018/06/30
15
+ - [#5](https://github.com/khiav223577/left_joins/pull/5) Fix: JoinDependency#make_constraints is not defined in Rails 4.0 (@khiav223577)
16
+
17
+ ### [v1.0.2](https://github.com/khiav223577/left_joins/compare/v1.0.1...v1.0.2) 2018/01/12
18
+ - [#3](https://github.com/khiav223577/left_joins/pull/3) fix missing left joins when using in association condition (@khiav223577)
19
+
20
+ ### [v1.0.1](https://github.com/khiav223577/left_joins/compare/v1.0.0...v1.0.1) 2017/12/25
21
+ - [#2](https://github.com/khiav223577/left_joins/pull/2) Fix count which would sometimes force a DISTINCT (@khiav223577)
22
+
23
+ ### [v1.0.0](https://github.com/khiav223577/left_joins/compare/v1.0.0...v1.0.0) 2017/12/25
24
+ - [#1](https://github.com/khiav223577/left_joins/pull/1) implement left joins (@khiav223577)
@@ -1,49 +1,49 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at mrtmrt15xn@yahoo.com.tw. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at mrtmrt15xn@yahoo.com.tw. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
49
  [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile CHANGED
@@ -1,13 +1,13 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in rails_or.gemspec
4
-
5
- gem "activerecord", "~> 3.2"
6
-
7
- group :test do
8
- gem "simplecov"
9
- gem "codeclimate-test-reporter", "~> 1.0.0"
10
- end
11
-
12
- gemspec :path => "./"
13
-
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_or.gemspec
4
+
5
+ gem "activerecord", "~> 3.2"
6
+
7
+ group :test do
8
+ gem "simplecov"
9
+ gem "codeclimate-test-reporter", "~> 1.0.0"
10
+ end
11
+
12
+ gemspec :path => "./"
13
+
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 khiav reoy
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 khiav reoy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,46 +1,46 @@
1
- [![Gem Version](https://img.shields.io/gem/v/left_joins.svg?style=flat)](https://rubygems.org/gems/left_joins)
2
- [![Build Status](https://travis-ci.org/khiav223577/left_joins.svg?branch=master)](https://travis-ci.org/khiav223577/left_joins)
3
- [![RubyGems](http://img.shields.io/gem/dt/left_joins.svg?style=flat)](https://rubygems.org/gems/left_joins)
4
- [![Code Climate](https://codeclimate.com/github/khiav223577/left_joins/badges/gpa.svg)](https://codeclimate.com/github/khiav223577/left_joins)
5
- [![Test Coverage](https://codeclimate.com/github/khiav223577/left_joins/badges/coverage.svg)](https://codeclimate.com/github/khiav223577/left_joins/coverage)
6
-
7
- # LeftJoins
8
-
9
- Backport `left_joins` from Rails 5 for Rails 3 and 4.
10
-
11
- ## Installation
12
-
13
- Add this line to your application's Gemfile:
14
-
15
- ```ruby
16
- gem 'left_joins'
17
- ```
18
-
19
- And then execute:
20
-
21
- $ bundle
22
-
23
- Or install it yourself as:
24
-
25
- $ gem install left_joins
26
-
27
- ## Usage
28
-
29
-
30
-
31
-
32
- ## Development
33
-
34
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
-
36
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
-
38
- ## Contributing
39
-
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/khiav223577/left_joins. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
-
42
-
43
- ## License
44
-
45
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
-
1
+ [![Gem Version](https://img.shields.io/gem/v/left_joins.svg?style=flat)](https://rubygems.org/gems/left_joins)
2
+ [![Build Status](https://travis-ci.org/khiav223577/left_joins.svg?branch=master)](https://travis-ci.org/khiav223577/left_joins)
3
+ [![RubyGems](http://img.shields.io/gem/dt/left_joins.svg?style=flat)](https://rubygems.org/gems/left_joins)
4
+ [![Code Climate](https://codeclimate.com/github/khiav223577/left_joins/badges/gpa.svg)](https://codeclimate.com/github/khiav223577/left_joins)
5
+ [![Test Coverage](https://codeclimate.com/github/khiav223577/left_joins/badges/coverage.svg)](https://codeclimate.com/github/khiav223577/left_joins/coverage)
6
+
7
+ # LeftJoins
8
+
9
+ Backport `left_joins` from Rails 5 for Rails 3 and 4.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'left_joins'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install left_joins
26
+
27
+ ## Usage
28
+
29
+
30
+
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/khiav223577/left_joins. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
+
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
46
+
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
9
-
10
- task :default => :test
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "left_joins"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "left_joins"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install --gemfile=gemfiles/3.2.gemfile
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install --gemfile=gemfiles/3.2.gemfile
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,12 +1,12 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "activerecord", "~> 3.2.0"
4
-
5
- group :test do
6
- gem "simplecov"
7
- gem "codeclimate-test-reporter", "~> 1.0.0"
8
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 3.2.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,12 +1,12 @@
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
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
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
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,12 +1,12 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "activerecord", "~> 4.2.0"
4
-
5
- group :test do
6
- gem "simplecov"
7
- gem "codeclimate-test-reporter", "~> 1.0.0"
8
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 4.2.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,12 +1,12 @@
1
- source 'https://rubygems.org'
2
-
3
- gem "activerecord", "~> 5.0.0"
4
-
5
- group :test do
6
- gem "simplecov"
7
- gem "codeclimate-test-reporter", "~> 1.0.0"
8
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
1
+ source 'https://rubygems.org'
2
+
3
+ gem "activerecord", "~> 5.0.0"
4
+
5
+ group :test do
6
+ gem "simplecov"
7
+ gem "codeclimate-test-reporter", "~> 1.0.0"
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,12 +1,12 @@
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
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
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
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,12 +1,12 @@
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
- gem "sqlite3", "~> 1.3.6"
9
- end
10
-
11
- gemspec :path => "../"
12
-
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
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec :path => "../"
12
+
@@ -1,45 +1,45 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'left_joins/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "left_joins"
8
- spec.version = LeftJoins::VERSION
9
- spec.authors = ["khiav reoy"]
10
- spec.email = ["mrtmrt15xn@yahoo.com.tw"]
11
-
12
- spec.summary = %q{Backport `left_joins` from Rails 5 for Rails 3 and 4.}
13
- spec.description = %q{Backport `left_joins` from Rails 5 for Rails 3 and 4.}
14
- spec.homepage = "https://github.com/khiav223577/left_joins"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- #if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- #else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- #end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
- spec.metadata = {
30
- 'homepage_uri' => 'https://github.com/khiav223577/left_joins',
31
- 'changelog_uri' => 'https://github.com/khiav223577/left_joins/blob/master/CHANGELOG.md',
32
- 'source_code_uri' => 'https://github.com/khiav223577/left_joins',
33
- 'documentation_uri' => 'http://www.rubydoc.info/gems/left_joins',
34
- 'bug_tracker_uri' => 'https://github.com/khiav223577/left_joins/issues',
35
- }
36
-
37
- spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
38
- spec.add_development_dependency "rake", "~> 12.0"
39
- spec.add_development_dependency "sqlite3", "~> 1.3"
40
- spec.add_development_dependency "minitest", ">= 4.2"
41
- spec.add_development_dependency "pluck_all", ">= 2.0.2"
42
-
43
- spec.add_dependency "activerecord", ">= 3"
44
-
45
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'left_joins/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "left_joins"
8
+ spec.version = LeftJoins::VERSION
9
+ spec.authors = ["khiav reoy"]
10
+ spec.email = ["mrtmrt15xn@yahoo.com.tw"]
11
+
12
+ spec.summary = %q{Backport `left_joins` from Rails 5 for Rails 3 and 4.}
13
+ spec.description = %q{Backport `left_joins` from Rails 5 for Rails 3 and 4.}
14
+ spec.homepage = "https://github.com/khiav223577/left_joins"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ #end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ spec.metadata = {
30
+ 'homepage_uri' => 'https://github.com/khiav223577/left_joins',
31
+ 'changelog_uri' => 'https://github.com/khiav223577/left_joins/blob/master/CHANGELOG.md',
32
+ 'source_code_uri' => 'https://github.com/khiav223577/left_joins',
33
+ 'documentation_uri' => 'http://www.rubydoc.info/gems/left_joins',
34
+ 'bug_tracker_uri' => 'https://github.com/khiav223577/left_joins/issues',
35
+ }
36
+
37
+ spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
38
+ spec.add_development_dependency "rake", "~> 12.0"
39
+ spec.add_development_dependency "sqlite3", "~> 1.3"
40
+ spec.add_development_dependency "minitest", ">= 4.2"
41
+ spec.add_development_dependency "pluck_all", ">= 2.0.2"
42
+
43
+ spec.add_dependency "activerecord", ">= 3"
44
+
45
+ end
@@ -1,187 +1,178 @@
1
- require "left_joins/version"
2
- require 'active_record'
3
- require 'active_record/relation'
4
-
5
- module LeftJoins
6
- IS_RAILS3_FLAG = Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
7
- HAS_BUILT_IN_LEFT_JOINS_METHOD = ActiveRecord::QueryMethods.method_defined?(:left_outer_joins)
8
- require 'left_joins_for_rails_3' if IS_RAILS3_FLAG
9
-
10
- class << self
11
- def bind_values_of(relation)
12
- return relation.bound_attributes if relation.respond_to?(:bound_attributes) # For Rails 5.0, 5.1, 5.2
13
- return relation.bind_values # For Rails 4.2
14
- end
15
- end
16
- end
17
-
18
- module ActiveRecord::QueryMethods
19
- if not LeftJoins::HAS_BUILT_IN_LEFT_JOINS_METHOD
20
- # ----------------------------------------------------------------
21
- # ● Storing left joins values into @left_outer_joins_values
22
- # ----------------------------------------------------------------
23
- attr_writer :left_outer_joins_values
24
- def left_outer_joins_values
25
- @left_outer_joins_values ||= []
26
- end
27
-
28
- def left_outer_joins(*args)
29
- check_if_method_has_arguments!(:left_outer_joins, args)
30
-
31
- args.compact!
32
- args.flatten!
33
- self.distinct_value = false
34
-
35
- return (LeftJoins::IS_RAILS3_FLAG ? clone : spawn).left_outer_joins!(*args)
36
- end
37
-
38
- def left_outer_joins!(*args)
39
- left_outer_joins_values.concat(args)
40
- self
41
- end
42
-
43
- # ----------------------------------------------------------------
44
- # ● Implement left joins when building arel
45
- # ----------------------------------------------------------------
46
- alias_method :left_joins, :left_outer_joins
47
- alias_method :build_arel_without_outer_joins, :build_arel
48
- def build_arel(*args)
49
- arel = build_arel_without_outer_joins(*args)
50
- build_left_outer_joins(arel, @left_outer_joins_values) if @left_outer_joins_values
51
- return arel
52
- end
53
-
54
- alias_method :build_joins_without_join_type, :build_joins
55
- def build_joins(manager, joins, join_type = nil)
56
- Thread.current.thread_variable_set(:left_joins_join_type, join_type)
57
- result = build_joins_without_join_type(manager, joins)
58
- Thread.current.thread_variable_set(:left_joins_join_type, nil)
59
- return result
60
- end
61
-
62
- def build_left_outer_joins(manager, joins)
63
- result = build_joins(manager, joins, Arel::Nodes::OuterJoin)
64
- return result
65
- end
66
-
67
- class << ::ActiveRecord::Base
68
- def left_joins(*args)
69
- self.where('').left_joins(*args)
70
- end
71
- alias_method :left_outer_joins, :left_joins
72
- end
73
-
74
- class ::ActiveRecord::Associations::JoinDependency
75
- if private_method_defined?(:make_constraints)
76
- alias_method :make_constraints_without_hooking_join_type, :make_constraints
77
- def make_constraints(*args, join_type)
78
- join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
79
- return make_constraints_without_hooking_join_type(*args, join_type)
80
- end
81
- else
82
- alias_method :build_without_hooking_join_type, :build
83
- def build(associations, parent = nil, join_type = Arel::Nodes::InnerJoin)
84
- join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
85
- return build_without_hooking_join_type(associations, parent, join_type)
86
- end
87
- end
88
- end
89
-
90
- module ActiveRecord::Calculations
91
- # This method is copied from activerecord-4.2.10/lib/active_record/relation/calculations.rb
92
- # and modified this line `distinct = true` to `distinct = true if distinct == nil`
93
- def perform_calculation(operation, column_name, options = {})
94
- # TODO: Remove options argument as soon we remove support to
95
- # activerecord-deprecated_finders.
96
- operation = operation.to_s.downcase
97
-
98
- # If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count)
99
- distinct = options[:distinct] || self.distinct_value
100
-
101
- if operation == "count"
102
- column_name ||= (select_for_count || :all)
103
-
104
- unless arel.ast.grep(Arel::Nodes::OuterJoin).empty?
105
- distinct = true if distinct == nil
106
- end
107
-
108
- column_name = primary_key if column_name == :all && distinct
109
- distinct = nil if column_name =~ /\s*DISTINCT[\s(]+/i
110
- end
111
-
112
- if group_values.any?
113
- execute_grouped_calculation(operation, column_name, distinct)
114
- else
115
- execute_simple_calculation(operation, column_name, distinct)
116
- end
117
- end
118
- end
119
- end
120
- end
121
-
122
- # ----------------------------------------------------------------
123
- # ● Implement left joins when merging relations
124
- # ----------------------------------------------------------------
125
- if not LeftJoins::IS_RAILS3_FLAG
126
- require 'active_record/relation/merger'
127
- class ActiveRecord::Relation
128
- class Merger
129
- alias_method :merge_without_left_joins, :merge
130
- def merge
131
- values = other.left_outer_joins_values
132
- relation.left_outer_joins!(*values) if values.present?
133
- return merge_without_left_joins
134
- end
135
- end
136
- end
137
-
138
- module ActiveRecord
139
- module SpawnMethods
140
-
141
- private
142
-
143
- alias_method :relation_with_without_left_joins, :relation_with
144
- def relation_with(values) # :nodoc:
145
- result = relation_with_without_left_joins(values)
146
- result.left_outer_joins_values = self.left_outer_joins_values
147
- return result
148
- end
149
- end
150
- end
151
- end
152
-
153
- # ----------------------------------------------------------------
154
- # ● Implement left joins in update statement
155
- # ----------------------------------------------------------------
156
- module ActiveRecord
157
- class Relation
158
- if not LeftJoins::HAS_BUILT_IN_LEFT_JOINS_METHOD
159
- def has_join_values?
160
- joins_values.any? || left_outer_joins_values.any?
161
- end
162
-
163
- alias_method :update_all_without_left_joins_values, :update_all
164
-
165
- def update_all(updates)
166
- raise ArgumentError, "Empty list of attributes to change" if updates.blank?
167
-
168
- stmt = Arel::UpdateManager.new(arel.engine)
169
-
170
- stmt.set Arel.sql(@klass.send(:sanitize_sql_for_assignment, updates))
171
- stmt.table(table)
172
- stmt.key = table[primary_key]
173
-
174
- if has_join_values?
175
- @klass.connection.join_to_update(stmt, arel)
176
- else
177
- stmt.take(arel.limit)
178
- stmt.order(*arel.orders)
179
- stmt.wheres = arel.constraints
180
- end
181
-
182
- bvs = LeftJoins.bind_values_of(self) + bind_values
183
- @klass.connection.update stmt, 'SQL', bvs
184
- end
185
- end
186
- end
187
- end
1
+ require "left_joins/version"
2
+ require 'active_record'
3
+ require 'active_record/relation'
4
+
5
+ module LeftJoins
6
+ IS_RAILS3_FLAG = Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
7
+ HAS_BUILT_IN_LEFT_JOINS_METHOD = ActiveRecord::QueryMethods.method_defined?(:left_outer_joins)
8
+ require 'left_joins_for_rails_3' if IS_RAILS3_FLAG
9
+
10
+ class << self
11
+ def patch(target, method, as:)
12
+ return yield if target.singleton_methods.include?(method)
13
+
14
+ target.define_singleton_method(method, &as)
15
+ result = yield
16
+ target.singleton_class.send(:remove_method, method)
17
+
18
+ return result
19
+ end
20
+ end
21
+ end
22
+
23
+ module ActiveRecord::QueryMethods
24
+ if not LeftJoins::HAS_BUILT_IN_LEFT_JOINS_METHOD
25
+ # ----------------------------------------------------------------
26
+ # ● Storing left joins values into @left_outer_joins_values
27
+ # ----------------------------------------------------------------
28
+ attr_writer :left_outer_joins_values
29
+ def left_outer_joins_values
30
+ @left_outer_joins_values ||= []
31
+ end
32
+
33
+ def left_outer_joins(*args)
34
+ check_if_method_has_arguments!(:left_outer_joins, args)
35
+
36
+ args.compact!
37
+ args.flatten!
38
+ self.distinct_value = false
39
+
40
+ return (LeftJoins::IS_RAILS3_FLAG ? clone : spawn).left_outer_joins!(*args)
41
+ end
42
+
43
+ def left_outer_joins!(*args)
44
+ left_outer_joins_values.concat(args)
45
+ self
46
+ end
47
+
48
+ # ----------------------------------------------------------------
49
+ # Implement left joins when building arel
50
+ # ----------------------------------------------------------------
51
+ alias_method :left_joins, :left_outer_joins
52
+ alias_method :build_arel_without_outer_joins, :build_arel
53
+ def build_arel(*args)
54
+ arel = build_arel_without_outer_joins(*args)
55
+ build_left_outer_joins(arel, @left_outer_joins_values) if @left_outer_joins_values
56
+ return arel
57
+ end
58
+
59
+ alias_method :build_joins_without_join_type, :build_joins
60
+ def build_joins(manager, joins, join_type = nil)
61
+ Thread.current.thread_variable_set(:left_joins_join_type, join_type)
62
+ result = build_joins_without_join_type(manager, joins)
63
+ Thread.current.thread_variable_set(:left_joins_join_type, nil)
64
+ return result
65
+ end
66
+
67
+ def build_left_outer_joins(manager, joins)
68
+ result = build_joins(manager, joins, Arel::Nodes::OuterJoin)
69
+ return result
70
+ end
71
+
72
+ class << ::ActiveRecord::Base
73
+ def left_joins(*args)
74
+ self.where('').left_joins(*args)
75
+ end
76
+ alias_method :left_outer_joins, :left_joins
77
+ end
78
+
79
+ class ::ActiveRecord::Associations::JoinDependency
80
+ if private_method_defined?(:make_constraints)
81
+ alias_method :make_constraints_without_hooking_join_type, :make_constraints
82
+ def make_constraints(*args, join_type)
83
+ join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
84
+ return make_constraints_without_hooking_join_type(*args, join_type)
85
+ end
86
+ else
87
+ alias_method :build_without_hooking_join_type, :build
88
+ def build(associations, parent = nil, join_type = Arel::Nodes::InnerJoin)
89
+ join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
90
+ return build_without_hooking_join_type(associations, parent, join_type)
91
+ end
92
+ end
93
+ end
94
+
95
+ module ActiveRecord::Calculations
96
+ # This method is copied from activerecord-4.2.10/lib/active_record/relation/calculations.rb
97
+ # and modified this line `distinct = true` to `distinct = true if distinct == nil`
98
+ def perform_calculation(operation, column_name, options = {})
99
+ # TODO: Remove options argument as soon we remove support to
100
+ # activerecord-deprecated_finders.
101
+ operation = operation.to_s.downcase
102
+
103
+ # If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count)
104
+ distinct = options[:distinct] || self.distinct_value
105
+
106
+ if operation == "count"
107
+ column_name ||= (select_for_count || :all)
108
+
109
+ unless arel.ast.grep(Arel::Nodes::OuterJoin).empty?
110
+ distinct = true if distinct == nil
111
+ end
112
+
113
+ column_name = primary_key if column_name == :all && distinct
114
+ distinct = nil if column_name =~ /\s*DISTINCT[\s(]+/i
115
+ end
116
+
117
+ if group_values.any?
118
+ execute_grouped_calculation(operation, column_name, distinct)
119
+ else
120
+ execute_simple_calculation(operation, column_name, distinct)
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
126
+
127
+ # ----------------------------------------------------------------
128
+ # ● Implement left joins when merging relations
129
+ # ----------------------------------------------------------------
130
+ if not LeftJoins::IS_RAILS3_FLAG
131
+ require 'active_record/relation/merger'
132
+ class ActiveRecord::Relation
133
+ class Merger
134
+ alias_method :merge_without_left_joins, :merge
135
+ def merge
136
+ values = other.left_outer_joins_values
137
+ relation.left_outer_joins!(*values) if values.present?
138
+ return merge_without_left_joins
139
+ end
140
+ end
141
+ end
142
+
143
+ module ActiveRecord
144
+ module SpawnMethods
145
+
146
+ private
147
+
148
+ alias_method :relation_with_without_left_joins, :relation_with
149
+ def relation_with(values) # :nodoc:
150
+ result = relation_with_without_left_joins(values)
151
+ result.left_outer_joins_values = self.left_outer_joins_values
152
+ return result
153
+ end
154
+ end
155
+ end
156
+ end
157
+
158
+ # ----------------------------------------------------------------
159
+ # ● Implement left joins in update statement
160
+ # ----------------------------------------------------------------
161
+ module ActiveRecord
162
+ class Relation
163
+ if not LeftJoins::HAS_BUILT_IN_LEFT_JOINS_METHOD
164
+ alias_method :update_all_without_left_joins_values, :update_all
165
+
166
+ def update_all(*args)
167
+ local_joins_values = joins_values.clone
168
+ has_left_outer_joins = left_outer_joins_values.any?
169
+
170
+ LeftJoins.patch(self, :joins_values, as: ->{ local_joins_values }) do
171
+ LeftJoins.patch(local_joins_values, :any?, as: ->{ super() || has_left_outer_joins }) do
172
+ update_all_without_left_joins_values(*args)
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
@@ -1,3 +1,3 @@
1
- module LeftJoins
2
- VERSION = "1.0.6"
3
- end
1
+ module LeftJoins
2
+ VERSION = "1.0.7"
3
+ end
@@ -1,20 +1,20 @@
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
-
17
- def distinct_value=(v)
18
- self.uniq_value = v
19
- end
20
- end
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
+
17
+ def distinct_value=(v)
18
+ self.uniq_value = v
19
+ end
20
+ 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.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - khiav reoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-22 00:00:00.000000000 Z
11
+ date: 2019-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.7.6
155
+ rubygems_version: 2.6.14
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Backport `left_joins` from Rails 5 for Rails 3 and 4.