left_join 0.2.0 → 0.2.1

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: cbd1e1087f2324c39141cdd48a47dd51e89b842c
4
- data.tar.gz: 561a76881876900b8f5d71b0026d1c899724324c
3
+ metadata.gz: e425fcb4bc322481f4db996cfd74d53c15b10e62
4
+ data.tar.gz: 62d490da6a7d318c0d859825b01013c15ad1afec
5
5
  SHA512:
6
- metadata.gz: 14c930afa5688b049a8c021e7d98d4b67f3132e8ed51834b4df83daf38934a6d52d2400f94ae0c98dc397bb45e4956facd7404b043e05df811ea0849ab887457
7
- data.tar.gz: 62f3d176a8f5fbb308bd81317d559386c52dffdd61dee2510c100f409a81935e5698cf689042e150f2d47c50d47ba4570bf7f67b9289e57e4de08a21eecc0174
6
+ metadata.gz: 5241bce35f8074d8d8571e52ce092fbc097be75021829c346229d273bf6b3afe9102d762c20cd7c89f7e54ff3bfd83bedcb90740ced6532a8b10884a3cbbdb93
7
+ data.tar.gz: 3ba0feceb66694a94934171ba5dbd21fc6a8ce4427c614f8f402530d399cbbdbdf43bd27219244630401ed559ee3ab6a1ab3e2ffa8fc165d409ac7d4f9cb1543
@@ -0,0 +1,23 @@
1
+ rvm:
2
+ - 2.1
3
+ - 2.2
4
+ - 2.2.2
5
+ - jruby-1.7.22
6
+
7
+ gemfile:
8
+ - gemfiles/3.2.22.5.gemfile
9
+ - gemfiles/4.0.gemfile
10
+ - gemfiles/4.1.gemfile
11
+ - gemfiles/5.0.gemfile
12
+
13
+ matrix:
14
+ fast_finish: true
15
+ exclude:
16
+ - gemfile: gemfiles/5.0.gemfile
17
+ rvm: 2.1
18
+ - gemfile: gemfiles/5.0.gemfile
19
+ rvm: 2.2
20
+ - gemfile: gemfiles/5.0.gemfile
21
+ rvm: jruby-1.7.22
22
+
23
+ script: "bundle exec rspec"
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'http://rubygems.org'
3
3
  # Add dependencies to develop your gem here.
4
4
  # Include everything needed to run rake, tests, features, etc.
5
5
  group :development do
6
- gem 'rspec', '~> 3.3.0'
6
+ gem 'rspec', '~> 3.3'
7
7
  gem 'rdoc', '~> 3.12'
8
8
  gem 'bundler', '~> 1.0'
9
9
  gem 'jeweler', '~> 2.1.0'
@@ -14,7 +14,8 @@ GEM
14
14
  minitest (~> 5.1)
15
15
  thread_safe (~> 0.3, >= 0.3.4)
16
16
  tzinfo (~> 1.1)
17
- addressable (2.4.0)
17
+ addressable (2.5.0)
18
+ public_suffix (~> 2.0, >= 2.0.2)
18
19
  arel (6.0.3)
19
20
  builder (3.2.2)
20
21
  descendants_tracker (0.0.4)
@@ -24,58 +25,60 @@ GEM
24
25
  faraday (0.9.2)
25
26
  multipart-post (>= 1.2, < 3)
26
27
  git (1.3.0)
27
- github_api (0.13.1)
28
- addressable (~> 2.4.0)
29
- descendants_tracker (~> 0.0.4)
28
+ github_api (0.11.3)
29
+ addressable (~> 2.3)
30
+ descendants_tracker (~> 0.0.1)
30
31
  faraday (~> 0.8, < 0.10)
31
- hashie (>= 3.4)
32
+ hashie (>= 1.2)
32
33
  multi_json (>= 1.7.5, < 2.0)
34
+ nokogiri (~> 1.6.0)
33
35
  oauth2
34
- hashie (3.4.4)
36
+ hashie (3.4.6)
35
37
  highline (1.7.8)
36
38
  i18n (0.7.0)
37
- jeweler (2.1.1)
39
+ jeweler (2.1.2)
38
40
  builder
39
41
  bundler (>= 1.0)
40
42
  git (>= 1.2.5)
41
- github_api
43
+ github_api (~> 0.11.0)
42
44
  highline (>= 1.6.15)
43
45
  nokogiri (>= 1.5.10)
44
46
  rake
45
47
  rdoc
46
48
  semver
47
49
  json (1.8.3)
48
- jwt (1.5.1)
49
- mini_portile2 (2.0.0)
50
+ jwt (1.5.6)
51
+ mini_portile2 (2.1.0)
50
52
  minitest (5.9.0)
51
- multi_json (1.12.0)
52
- multi_xml (0.5.5)
53
+ multi_json (1.12.1)
54
+ multi_xml (0.6.0)
53
55
  multipart-post (2.0.0)
54
- nokogiri (1.6.7.2)
55
- mini_portile2 (~> 2.0.0.rc2)
56
- oauth2 (1.1.0)
56
+ nokogiri (1.6.8.1)
57
+ mini_portile2 (~> 2.1.0)
58
+ oauth2 (1.2.0)
57
59
  faraday (>= 0.8, < 0.10)
58
- jwt (~> 1.0, < 1.5.2)
60
+ jwt (~> 1.0)
59
61
  multi_json (~> 1.3)
60
62
  multi_xml (~> 0.5)
61
63
  rack (>= 1.2, < 3)
62
- rack (1.6.4)
63
- rake (11.1.2)
64
+ public_suffix (2.0.4)
65
+ rack (2.0.1)
66
+ rake (12.0.0)
64
67
  rdoc (3.12.2)
65
68
  json (~> 1.4)
66
- rspec (3.3.0)
67
- rspec-core (~> 3.3.0)
68
- rspec-expectations (~> 3.3.0)
69
- rspec-mocks (~> 3.3.0)
70
- rspec-core (3.3.2)
71
- rspec-support (~> 3.3.0)
72
- rspec-expectations (3.3.1)
69
+ rspec (3.5.0)
70
+ rspec-core (~> 3.5.0)
71
+ rspec-expectations (~> 3.5.0)
72
+ rspec-mocks (~> 3.5.0)
73
+ rspec-core (3.5.4)
74
+ rspec-support (~> 3.5.0)
75
+ rspec-expectations (3.5.0)
73
76
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.3.0)
75
- rspec-mocks (3.3.2)
77
+ rspec-support (~> 3.5.0)
78
+ rspec-mocks (3.5.0)
76
79
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.3.0)
78
- rspec-support (3.3.0)
80
+ rspec-support (~> 3.5.0)
81
+ rspec-support (3.5.0)
79
82
  semver (1.0.1)
80
83
  simplecov (0.11.2)
81
84
  docile (~> 1.1.0)
@@ -95,9 +98,9 @@ DEPENDENCIES
95
98
  bundler (~> 1.0)
96
99
  jeweler (~> 2.1.0)
97
100
  rdoc (~> 3.12)
98
- rspec (~> 3.3.0)
101
+ rspec (~> 3.3)
99
102
  simplecov
100
103
  sqlite3
101
104
 
102
105
  BUNDLED WITH
103
- 1.12.2
106
+ 1.13.1
data/README.md CHANGED
@@ -12,7 +12,7 @@ Book.left_join(:category)
12
12
 
13
13
  ## Why?
14
14
 
15
- See [this blog post](http://nerde.github.io/posts/a-better-left-join-with-active-record/)
15
+ See [this blog post](http://nerde.github.io/posts/a-better-left-join-with-active-record)
16
16
  for details.
17
17
 
18
18
  ## Installation
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'activerecord', '= 3.2.22.5'
4
+ gem 'rspec'
5
+ gem 'sqlite3', platform: [:ruby, :mswin, :mingw]
6
+ gem 'jdbc-sqlite3', platform: :jruby
7
+ gem 'activerecord-jdbc-adapter', platform: :jruby
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 4.0.0'
4
+ gem 'rspec'
5
+ gem 'sqlite3', platform: [:ruby, :mswin, :mingw]
6
+ gem 'jdbc-sqlite3', platform: :jruby
7
+ gem 'activerecord-jdbc-adapter', platform: :jruby
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 4.1.0'
4
+ gem 'rspec'
5
+ gem 'sqlite3', platform: [:ruby, :mswin, :mingw]
6
+ gem 'jdbc-sqlite3', platform: :jruby
7
+ gem 'activerecord-jdbc-adapter', platform: :jruby
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'activerecord', '~> 5.0.0'
4
+ gem 'rspec'
5
+ gem 'sqlite3', platform: [:ruby, :mswin, :mingw]
6
+ gem 'jdbc-sqlite3', platform: :jruby
7
+ gem 'activerecord-jdbc-adapter', platform: :jruby
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: left_join 0.2.0 ruby lib
5
+ # stub: left_join 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "left_join"
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Diego Aguir Selzlein"]
14
- s.date = "2016-05-18"
14
+ s.date = "2016-12-22"
15
15
  s.description = "This gem helps doing LEFT JOIN's between ActiveRecord associations"
16
16
  s.email = "diegoselzlein@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -21,12 +21,17 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  ".document",
23
23
  ".rspec",
24
+ ".travis.yml",
24
25
  "Gemfile",
25
26
  "Gemfile.lock",
26
27
  "LICENSE.txt",
27
28
  "README.md",
28
29
  "Rakefile",
29
30
  "VERSION",
31
+ "gemfiles/3.2.22.5.gemfile",
32
+ "gemfiles/4.0.gemfile",
33
+ "gemfiles/4.1.gemfile",
34
+ "gemfiles/5.0.gemfile",
30
35
  "left_join.gemspec",
31
36
  "lib/left_join.rb",
32
37
  "lib/left_join/adapters/active_record_adapter.rb",
@@ -42,7 +47,7 @@ Gem::Specification.new do |s|
42
47
  s.specification_version = 4
43
48
 
44
49
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_development_dependency(%q<rspec>, ["~> 3.3.0"])
50
+ s.add_development_dependency(%q<rspec>, ["~> 3.3"])
46
51
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
52
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
48
53
  s.add_development_dependency(%q<jeweler>, ["~> 2.1.0"])
@@ -50,7 +55,7 @@ Gem::Specification.new do |s|
50
55
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
51
56
  s.add_development_dependency(%q<activerecord>, [">= 0"])
52
57
  else
53
- s.add_dependency(%q<rspec>, ["~> 3.3.0"])
58
+ s.add_dependency(%q<rspec>, ["~> 3.3"])
54
59
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
60
  s.add_dependency(%q<bundler>, ["~> 1.0"])
56
61
  s.add_dependency(%q<jeweler>, ["~> 2.1.0"])
@@ -59,7 +64,7 @@ Gem::Specification.new do |s|
59
64
  s.add_dependency(%q<activerecord>, [">= 0"])
60
65
  end
61
66
  else
62
- s.add_dependency(%q<rspec>, ["~> 3.3.0"])
67
+ s.add_dependency(%q<rspec>, ["~> 3.3"])
63
68
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
64
69
  s.add_dependency(%q<bundler>, ["~> 1.0"])
65
70
  s.add_dependency(%q<jeweler>, ["~> 2.1.0"])
@@ -12,10 +12,22 @@ module LeftJoin
12
12
  #
13
13
  # Book.left_join(category: :master_category)
14
14
  def left_join(*columns)
15
- joins(ActiveRecord::Associations::JoinDependency.new(self, columns, []))
15
+ join_dependency = ActiveRecord::Associations::JoinDependency.new(self, columns, [])
16
+ if RAILS4_1_PLUS
17
+ joins(join_dependency)
18
+ else
19
+ join_dependency.join_associations.inject(self) do |result, association|
20
+ association.join_relation(result)
21
+ end
22
+ end
16
23
  end
24
+
25
+ alias_method :left_joins, :left_join
17
26
  end
18
27
 
19
- ActiveRecord::Base.extend ActiveRecordAdapter if defined?(ActiveRecord)
28
+ if defined?(ActiveRecord)
29
+ ActiveRecord::Base.extend ActiveRecordAdapter
30
+ RAILS4_1_PLUS = ActiveRecord::VERSION::MAJOR > 4 || (4 == ActiveRecord::VERSION::MAJOR && ActiveRecord::VERSION::MINOR >= 1)
31
+ end
20
32
  end
21
33
  end
@@ -25,6 +25,12 @@ describe 'LeftJoin' do
25
25
  "\"categories\".\"id\" = \"books\".\"category_id\"")
26
26
  end
27
27
 
28
+ it 'aliases left_join as left_joins' do
29
+ expect(Book.left_joins(:category).to_sql).to eq(
30
+ "SELECT \"books\".* FROM \"books\" LEFT OUTER JOIN \"categories\" ON "\
31
+ "\"categories\".\"id\" = \"books\".\"category_id\"")
32
+ end
33
+
28
34
  it 'works with nested associations' do
29
35
  expect(Category.left_join(books: :author).to_sql).to eq(
30
36
  "SELECT \"categories\".* FROM \"categories\" "\
@@ -1,19 +1,21 @@
1
- require 'simplecov'
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
2
3
 
3
- module SimpleCov::Configuration
4
- def clean_filters
5
- @filters = []
4
+ module SimpleCov::Configuration
5
+ def clean_filters
6
+ @filters = []
7
+ end
6
8
  end
7
- end
8
9
 
9
- SimpleCov.configure do
10
- clean_filters
11
- load_profile 'test_frameworks'
12
- end
10
+ SimpleCov.configure do
11
+ clean_filters
12
+ load_profile 'test_frameworks'
13
+ end
13
14
 
14
- ENV['COVERAGE'] && SimpleCov.start do
15
- add_filter '/.rvm/'
16
- add_filter '/.rbenv/'
15
+ SimpleCov.start do
16
+ add_filter '/.rvm/'
17
+ add_filter '/.rbenv/'
18
+ end
17
19
  end
18
20
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
19
21
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: left_join
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Aguir Selzlein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0
19
+ version: '3.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.3.0
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -118,12 +118,17 @@ extra_rdoc_files:
118
118
  files:
119
119
  - ".document"
120
120
  - ".rspec"
121
+ - ".travis.yml"
121
122
  - Gemfile
122
123
  - Gemfile.lock
123
124
  - LICENSE.txt
124
125
  - README.md
125
126
  - Rakefile
126
127
  - VERSION
128
+ - gemfiles/3.2.22.5.gemfile
129
+ - gemfiles/4.0.gemfile
130
+ - gemfiles/4.1.gemfile
131
+ - gemfiles/5.0.gemfile
127
132
  - left_join.gemspec
128
133
  - lib/left_join.rb
129
134
  - lib/left_join/adapters/active_record_adapter.rb