gutentag 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2220c5448de91dad49288b5d2370588e09a08bf863f3398b1ef0eb07e54691ef
4
- data.tar.gz: 42b8046acab85218e0e3ecea86ae5d1fb27e2ca69895567b66d66227b3070ffe
3
+ metadata.gz: e934d0f1e941db5003a28ee2dc0ca30592db0b594f5633eeac2374f6a0ee8f9f
4
+ data.tar.gz: 8972fd4264e0dad5499ddbd7c9642caf8b15052fa78b63bebec6de4c57f1b9b6
5
5
  SHA512:
6
- metadata.gz: a151247791c559ff523ebb8af939ed28a0d55932b1d99d0476fa77a6ae9bafe724526ed1f21a3eb38d05ea0a371540e15c659f69e062abfe90f33f337b7ee71d
7
- data.tar.gz: fd7f8db5ee16bd1fb854e9d2ad3bf18dc5b48de866e307bc750a4ff525ab303981e3eddef1ac562bbe0918fdd32e088543fba7025d09a4ff2af7e87d2694c8dc
6
+ metadata.gz: 55961186203575a716c658bd966102d344badbe8940f88523e6e4e76d795b8a9089be43320fd40735b749ed7f4507d3fe7d509bdd6f942dd9d2fabfb0d32e89b
7
+ data.tar.gz: 90f27936f1f5a96b522d26ad53ce8c74309fdc62c4409cb662112ee8603e610158ae379785646217b0cc61ea5a5e4150d31eaea77ea83033828c0d0af2db8771
@@ -6,7 +6,7 @@ rvm:
6
6
  - 2.4.6
7
7
  - 2.5.5
8
8
  - 2.6.3
9
- - jruby-9.2.7.0
9
+ # - jruby-9.2.8.0
10
10
  before_install:
11
11
  - gem install bundler --version 1.17.3
12
12
  install:
data/Appraisals CHANGED
@@ -36,7 +36,7 @@ appraise "rails_5_2" do
36
36
  end if RUBY_VERSION.to_f >= 2.2
37
37
 
38
38
  appraise "rails_6_0" do
39
- gem "rails", "~> 6.0.0.beta1"
39
+ gem "rails", "~> 6.0.0.rc1"
40
40
  gem "pg", "~> 1.0", :platform => :ruby
41
41
  gem "mysql2", "~> 0.5.0", :platform => :ruby
42
42
  gem "sqlite3", "~> 1.4", :platform => :ruby
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project (at least, from v0.5.0 onwards) will be documented in this file.
4
4
 
5
+ ## 2.5.2 - 2019-07-08
6
+
7
+ ### Fixed
8
+
9
+ * `tag_names` will no longer be referenced as a database column when tagged models are requested in joins in Rails 4.2 (as reported in [issue #67](https://github.com/pat/gutentag/issues/67)).
10
+
5
11
  ## 2.5.1 - 2019-05-10
6
12
 
7
13
  ### Fixed
@@ -10,7 +16,7 @@ All notable changes to this project (at least, from v0.5.0 onwards) will be docu
10
16
 
11
17
  ## 2.5.0 - 2019-03-15
12
18
 
13
- **Pleease note this release ends official support of Rails 3.2 and Ruby (MRI) 2.2.** The code currently still works on Ruby 2.2, and all features except for the new `Gutentag::Tag.names_for_scope` method work in Rails 3.2, but they're no longer tested against, and cannot be guaranteed to work in future releases.
19
+ **Please note this release ends official support of Rails 3.2 and Ruby (MRI) 2.2.** The code currently still works on Ruby 2.2, and all features except for the new `Gutentag::Tag.names_for_scope` method work in Rails 3.2, but they're no longer tested against, and cannot be guaranteed to work in future releases.
14
20
 
15
21
  ### Added
16
22
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "gutentag"
5
- s.version = "2.5.1"
5
+ s.version = "2.5.2"
6
6
  s.authors = ["Pat Allan"]
7
7
  s.email = ["pat@freelancing-gods.com"]
8
8
  s.homepage = "https://github.com/pat/gutentag"
@@ -22,6 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "database_cleaner", "~> 1.6"
23
23
  s.add_development_dependency "rails"
24
24
  s.add_development_dependency "rspec-rails", "~> 3.1"
25
- s.add_development_dependency "rubocop", "~> 0.68.1"
25
+ s.add_development_dependency "rubocop", "~> 0.72.0"
26
26
  s.add_development_dependency "rubocop-performance", "~> 1"
27
27
  end
@@ -31,7 +31,7 @@ class Gutentag::ActiveRecord
31
31
  end
32
32
 
33
33
  def add_attribute
34
- if legacy?
34
+ if ActiveRecord::VERSION::STRING.to_f <= 4.2
35
35
  model.define_attribute_method "tag_names"
36
36
  else
37
37
  model.attribute "tag_names", ActiveRecord::Type::Value.new,
@@ -8,22 +8,25 @@ module Gutentag::ActiveRecord::InstanceMethods
8
8
  def reset_tag_names
9
9
  # Update the underlying value rather than going through the setter, to
10
10
  # ensure this update doesn't get marked as a 'change'.
11
- self.tag_names = nil
11
+ @tag_names = nil
12
12
  end
13
13
 
14
14
  def tag_names
15
- # If the underlying value is nil, we've not requested this from the
16
- # database yet.
17
- if read_attribute("tag_names") { nil }.nil?
18
- self.tag_names = tags.pluck(:name)
15
+ @tag_names ||= begin
16
+ raw = tags.pluck(:name)
17
+ raw_write_attribute "tag_names", raw
18
+ raw
19
19
  end
20
-
21
- # Use ActiveRecord's underlying implementation with change tracking.
22
- super
23
20
  end
24
21
 
25
22
  def tag_names=(names)
26
- super Gutentag::TagNames.call(names)
23
+ new_names = Gutentag::TagNames.call names
24
+ return if new_names.sort == tag_names.sort
25
+
26
+ tag_names_will_change!
27
+
28
+ write_attribute "tag_names", new_names
29
+ @tag_names = new_names
27
30
  end
28
31
 
29
32
  private
@@ -135,4 +135,8 @@ describe "Managing tags via names" do
135
135
 
136
136
  expect(article.tag_names).to eq(%w[ melbourne ])
137
137
  end
138
+
139
+ it "allows eager-loading of the model via an association" do
140
+ expect { Comment.eager_load(:article).to_a }.to_not raise_error
141
+ end
138
142
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Comment < ActiveRecord::Base
4
+ belongs_to :article
5
+ end
@@ -6,4 +6,10 @@ ActiveRecord::Schema.define do
6
6
  t.string :type
7
7
  t.timestamps :null => false
8
8
  end
9
+
10
+ create_table :comments, :force => true do |t|
11
+ t.references :article
12
+ t.string :name
13
+ t.text :text
14
+ end
9
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gutentag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.68.1
117
+ version: 0.72.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.68.1
124
+ version: 0.72.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +183,7 @@ files:
183
183
  - spec/gutentag/active_record_spec.rb
184
184
  - spec/gutentag_spec.rb
185
185
  - spec/internal/app/models/article.rb
186
+ - spec/internal/app/models/comment.rb
186
187
  - spec/internal/app/models/thinkpiece.rb
187
188
  - spec/internal/config/database.yml
188
189
  - spec/internal/db/schema.rb