left_joins 1.0.5 → 1.0.6

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
  SHA256:
3
- metadata.gz: 96d6f9767a640b7ba9ce3b37443298771f1744dd74b77df7cf309996bf9fd52d
4
- data.tar.gz: c2275de76d3c6355673cb09c41ea2adc5bfb6f91bf2b3c189eb9d464a337c416
3
+ metadata.gz: 6110dc9b1424da69502db597837daca734b0b498be812bc6af4e86661bdee4bd
4
+ data.tar.gz: 6d62196f6ec5b138cfa098049040b230319b9a2e0bb814e8e6474b36a701a1cb
5
5
  SHA512:
6
- metadata.gz: ad73bace7c184fabcecc0a05752ffff2393c08c82c8b3cfacb3d8b5407e6eab5bb9c5e329eece38c3194881c88576e9ca543638ff7cf638e0c944f2a8acda3a1
7
- data.tar.gz: 93a6300e3b775b706320700ab87fbe4172ed818e06b5fd3eb7e958b22886fd105625410a22a720de6ce622ceefd26384caf242c5298a0ad9aad8ae1e08e2db35
6
+ metadata.gz: f2326bf1bda17f3713f38dd6535b58683dce063da97e09add2cc42958b835e2f41dad6a83922799f0f79c442b7b938228ed72f90bca5019f79cf0aa117d09ebe
7
+ data.tar.gz: 8f9c9a008fbd944402809d90c1b523fbdb2ed5c516af5f612c7fa14a519f6d2c67248137e659bd07c60291fa1af0eb3551fb575349cded0326a3f95683edca18
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,16 +1,21 @@
1
- ## Change Log
2
-
3
- ### [v1.0.4](https://github.com/khiav223577/left_joins/compare/v1.0.3...v1.0.4) 2018/07/18
4
- - [#7](https://github.com/khiav223577/left_joins/pull/7) Fix: eager_load is broken (@khiav223577)
5
-
6
- ### [v1.0.3](https://github.com/khiav223577/left_joins/compare/v1.0.2...v1.0.3) 2018/06/30
7
- - [#5](https://github.com/khiav223577/left_joins/pull/5) Fix: JoinDependency#make_constraints is not defined in Rails 4.0 (@khiav223577)
8
-
9
- ### [v1.0.2](https://github.com/khiav223577/left_joins/compare/v1.0.1...v1.0.2) 2018/01/12
10
- - [#3](https://github.com/khiav223577/left_joins/pull/3) fix missing left joins when using in association condition (@khiav223577)
11
-
12
- ### [v1.0.1](https://github.com/khiav223577/left_joins/compare/v1.0.0...v1.0.1) 2017/12/25
13
- - [#2](https://github.com/khiav223577/left_joins/pull/2) Fix count which would sometimes force a DISTINCT (@khiav223577)
14
-
15
- ### v1.0.0 2017/12/25
16
- - [#1](https://github.com/khiav223577/left_joins/pull/1) implement left joins (@khiav223577)
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,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,41 +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
- 'changelog_uri' => 'https://github.com/khiav223577/left_joins/blob/master/CHANGELOG.md',
31
- }
32
-
33
- spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
34
- spec.add_development_dependency "rake", "~> 12.0"
35
- spec.add_development_dependency "sqlite3", "~> 1.3"
36
- spec.add_development_dependency "minitest", ">= 4.2"
37
- spec.add_development_dependency "pluck_all", ">= 2.0.2"
38
-
39
- spec.add_dependency "activerecord", ">= 3"
40
-
41
- 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,143 +1,187 @@
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
- require 'left_joins_for_rails_3' if IS_RAILS3_FLAG
8
- end
9
-
10
- module ActiveRecord::QueryMethods
11
- if not method_defined?(:left_outer_joins!)
12
- # ----------------------------------------------------------------
13
- # Storing left joins values into @left_outer_joins_values
14
- # ----------------------------------------------------------------
15
- attr_writer :left_outer_joins_values
16
- def left_outer_joins_values
17
- @left_outer_joins_values ||= []
18
- end
19
-
20
- def left_outer_joins(*args)
21
- check_if_method_has_arguments!(:left_outer_joins, args)
22
-
23
- args.compact!
24
- args.flatten!
25
- self.distinct_value = false
26
-
27
- return (LeftJoins::IS_RAILS3_FLAG ? clone : spawn).left_outer_joins!(*args)
28
- end
29
-
30
- def left_outer_joins!(*args)
31
- left_outer_joins_values.concat(args)
32
- self
33
- end
34
-
35
- # ----------------------------------------------------------------
36
- # ● Implement left joins when building arel
37
- # ----------------------------------------------------------------
38
- alias_method :left_joins, :left_outer_joins
39
- alias_method :build_arel_without_outer_joins, :build_arel
40
- def build_arel(*args)
41
- arel = build_arel_without_outer_joins(*args)
42
- build_left_outer_joins(arel, @left_outer_joins_values) if @left_outer_joins_values
43
- return arel
44
- end
45
-
46
- alias_method :build_joins_without_join_type, :build_joins
47
- def build_joins(manager, joins, join_type = nil)
48
- Thread.current.thread_variable_set(:left_joins_join_type, join_type)
49
- result = build_joins_without_join_type(manager, joins)
50
- Thread.current.thread_variable_set(:left_joins_join_type, nil)
51
- return result
52
- end
53
-
54
- def build_left_outer_joins(manager, joins)
55
- result = build_joins(manager, joins, Arel::Nodes::OuterJoin)
56
- return result
57
- end
58
-
59
- class << ::ActiveRecord::Base
60
- def left_joins(*args)
61
- self.where('').left_joins(*args)
62
- end
63
- alias_method :left_outer_joins, :left_joins
64
- end
65
-
66
- class ::ActiveRecord::Associations::JoinDependency
67
- if private_method_defined?(:make_constraints)
68
- alias_method :make_constraints_without_hooking_join_type, :make_constraints
69
- def make_constraints(*args, join_type)
70
- join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
71
- return make_constraints_without_hooking_join_type(*args, join_type)
72
- end
73
- else
74
- alias_method :build_without_hooking_join_type, :build
75
- def build(associations, parent = nil, join_type = Arel::Nodes::InnerJoin)
76
- join_type = Thread.current.thread_variable_get(:left_joins_join_type) || join_type
77
- return build_without_hooking_join_type(associations, parent, join_type)
78
- end
79
- end
80
- end
81
-
82
- module ActiveRecord::Calculations
83
- # This method is copied from activerecord-4.2.10/lib/active_record/relation/calculations.rb
84
- # and modified this line `distinct = true` to `distinct = true if distinct == nil`
85
- def perform_calculation(operation, column_name, options = {})
86
- # TODO: Remove options argument as soon we remove support to
87
- # activerecord-deprecated_finders.
88
- operation = operation.to_s.downcase
89
-
90
- # If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count)
91
- distinct = options[:distinct] || self.distinct_value
92
-
93
- if operation == "count"
94
- column_name ||= (select_for_count || :all)
95
-
96
- unless arel.ast.grep(Arel::Nodes::OuterJoin).empty?
97
- distinct = true if distinct == nil
98
- end
99
-
100
- column_name = primary_key if column_name == :all && distinct
101
- distinct = nil if column_name =~ /\s*DISTINCT[\s(]+/i
102
- end
103
-
104
- if group_values.any?
105
- execute_grouped_calculation(operation, column_name, distinct)
106
- else
107
- execute_simple_calculation(operation, column_name, distinct)
108
- end
109
- end
110
- end
111
- end
112
- end
113
-
114
- # ----------------------------------------------------------------
115
- # Implement left joins when merging relations
116
- # ----------------------------------------------------------------
117
- if not LeftJoins::IS_RAILS3_FLAG
118
- require 'active_record/relation/merger'
119
- class ActiveRecord::Relation
120
- class Merger
121
- alias_method :merge_without_left_joins, :merge
122
- def merge
123
- values = other.left_outer_joins_values
124
- relation.left_outer_joins!(*values) if values.present?
125
- return merge_without_left_joins
126
- end
127
- end
128
- end
129
-
130
- module ActiveRecord
131
- module SpawnMethods
132
-
133
- private
134
-
135
- alias_method :relation_with_without_left_joins, :relation_with
136
- def relation_with(values) # :nodoc:
137
- result = relation_with_without_left_joins(values)
138
- result.left_outer_joins_values = self.left_outer_joins_values
139
- return result
140
- end
141
- end
142
- end
143
- 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 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,3 +1,3 @@
1
- module LeftJoins
2
- VERSION = "1.0.5"
3
- end
1
+ module LeftJoins
2
+ VERSION = "1.0.6"
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.5
4
+ version: 1.0.6
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-04-11 00:00:00.000000000 Z
11
+ date: 2019-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,7 +131,11 @@ homepage: https://github.com/khiav223577/left_joins
131
131
  licenses:
132
132
  - MIT
133
133
  metadata:
134
+ homepage_uri: https://github.com/khiav223577/left_joins
134
135
  changelog_uri: https://github.com/khiav223577/left_joins/blob/master/CHANGELOG.md
136
+ source_code_uri: https://github.com/khiav223577/left_joins
137
+ documentation_uri: http://www.rubydoc.info/gems/left_joins
138
+ bug_tracker_uri: https://github.com/khiav223577/left_joins/issues
135
139
  post_install_message:
136
140
  rdoc_options: []
137
141
  require_paths: