friendly_id 5.4.2 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +34 -25
- data/Changelog.md +6 -0
- data/Gemfile +9 -13
- data/README.md +21 -0
- data/Rakefile +24 -27
- data/bench.rb +30 -27
- data/certs/parndt.pem +25 -23
- data/friendly_id.gemspec +26 -29
- data/gemfiles/Gemfile.rails-5.2.rb +11 -16
- data/gemfiles/Gemfile.rails-6.0.rb +11 -16
- data/gemfiles/Gemfile.rails-6.1.rb +22 -0
- data/gemfiles/Gemfile.rails-7.0.rb +22 -0
- data/guide.rb +5 -5
- data/lib/friendly_id/base.rb +57 -60
- data/lib/friendly_id/candidates.rb +9 -11
- data/lib/friendly_id/configuration.rb +6 -7
- data/lib/friendly_id/finder_methods.rb +26 -11
- data/lib/friendly_id/finders.rb +63 -66
- data/lib/friendly_id/history.rb +59 -63
- data/lib/friendly_id/initializer.rb +4 -4
- data/lib/friendly_id/migration.rb +6 -6
- data/lib/friendly_id/object_utils.rb +2 -2
- data/lib/friendly_id/reserved.rb +28 -32
- data/lib/friendly_id/scoped.rb +97 -102
- data/lib/friendly_id/sequentially_slugged/calculator.rb +69 -0
- data/lib/friendly_id/sequentially_slugged.rb +17 -64
- data/lib/friendly_id/simple_i18n.rb +75 -69
- data/lib/friendly_id/slug.rb +1 -2
- data/lib/friendly_id/slug_generator.rb +1 -3
- data/lib/friendly_id/slugged.rb +234 -238
- data/lib/friendly_id/version.rb +1 -1
- data/lib/friendly_id.rb +41 -45
- data/lib/generators/friendly_id_generator.rb +9 -9
- data/test/base_test.rb +10 -13
- data/test/benchmarks/finders.rb +28 -26
- data/test/benchmarks/object_utils.rb +13 -13
- data/test/candidates_test.rb +17 -18
- data/test/configuration_test.rb +7 -11
- data/test/core_test.rb +1 -2
- data/test/databases.yml +4 -3
- data/test/finders_test.rb +52 -5
- data/test/generator_test.rb +16 -26
- data/test/helper.rb +29 -22
- data/test/history_test.rb +70 -74
- data/test/numeric_slug_test.rb +4 -4
- data/test/object_utils_test.rb +0 -2
- data/test/reserved_test.rb +9 -11
- data/test/schema.rb +5 -4
- data/test/scoped_test.rb +18 -20
- data/test/sequentially_slugged_test.rb +65 -50
- data/test/shared.rb +15 -16
- data/test/simple_i18n_test.rb +22 -12
- data/test/slugged_test.rb +102 -121
- data/test/sti_test.rb +19 -21
- data.tar.gz.sig +0 -0
- metadata +35 -30
- metadata.gz.sig +1 -1
data/test/sti_test.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
3
|
class StiTest < TestCaseClass
|
4
|
-
|
5
4
|
include FriendlyId::Test
|
6
5
|
include FriendlyId::Test::Shared::Core
|
7
6
|
include FriendlyId::Test::Shared::Slugged
|
8
7
|
|
9
8
|
class Journalist < ActiveRecord::Base
|
10
9
|
extend FriendlyId
|
11
|
-
friendly_id :name, :
|
10
|
+
friendly_id :name, use: [:slugged]
|
12
11
|
end
|
13
12
|
|
14
13
|
class Editorialist < Journalist
|
@@ -20,9 +19,11 @@ class StiTest < TestCaseClass
|
|
20
19
|
|
21
20
|
test "friendly_id should accept a base and a hash with single table inheritance" do
|
22
21
|
abstract_klass = Class.new(ActiveRecord::Base) do
|
23
|
-
def self.table_exists
|
22
|
+
def self.table_exists?
|
23
|
+
false
|
24
|
+
end
|
24
25
|
extend FriendlyId
|
25
|
-
friendly_id :foo, :
|
26
|
+
friendly_id :foo, use: :slugged, slug_column: :bar
|
26
27
|
end
|
27
28
|
klass = Class.new(abstract_klass)
|
28
29
|
assert klass < FriendlyId::Slugged
|
@@ -36,7 +37,9 @@ class StiTest < TestCaseClass
|
|
36
37
|
|
37
38
|
test "friendly_id should accept a block with single table inheritance" do
|
38
39
|
abstract_klass = Class.new(ActiveRecord::Base) do
|
39
|
-
def self.table_exists
|
40
|
+
def self.table_exists?
|
41
|
+
false
|
42
|
+
end
|
40
43
|
extend FriendlyId
|
41
44
|
friendly_id :foo do |config|
|
42
45
|
config.use :slugged
|
@@ -52,10 +55,10 @@ class StiTest < TestCaseClass
|
|
52
55
|
|
53
56
|
test "friendly_id slugs should not clash with each other" do
|
54
57
|
transaction do
|
55
|
-
journalist
|
56
|
-
editoralist = model_class.create! :
|
58
|
+
journalist = model_class.base_class.create! name: "foo bar"
|
59
|
+
editoralist = model_class.create! name: "foo bar"
|
57
60
|
|
58
|
-
assert_equal
|
61
|
+
assert_equal "foo-bar", journalist.slug
|
59
62
|
assert_match(/foo-bar-.+/, editoralist.slug)
|
60
63
|
end
|
61
64
|
end
|
@@ -64,7 +67,7 @@ end
|
|
64
67
|
class StiTestWithHistory < StiTest
|
65
68
|
class Journalist < ActiveRecord::Base
|
66
69
|
extend FriendlyId
|
67
|
-
friendly_id :name, :
|
70
|
+
friendly_id :name, use: [:slugged, :history]
|
68
71
|
end
|
69
72
|
|
70
73
|
class Editorialist < Journalist
|
@@ -75,19 +78,17 @@ class StiTestWithHistory < StiTest
|
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
78
|
-
|
79
81
|
class StiTestWithFinders < TestCaseClass
|
80
|
-
|
81
82
|
include FriendlyId::Test
|
82
83
|
|
83
84
|
class Journalist < ActiveRecord::Base
|
84
85
|
extend FriendlyId
|
85
|
-
friendly_id :name, :
|
86
|
+
friendly_id :name, use: [:slugged, :finders]
|
86
87
|
end
|
87
88
|
|
88
89
|
class Editorialist < Journalist
|
89
90
|
extend FriendlyId
|
90
|
-
friendly_id :name, :
|
91
|
+
friendly_id :name, use: [:slugged, :finders]
|
91
92
|
end
|
92
93
|
|
93
94
|
def model_class
|
@@ -96,22 +97,20 @@ class StiTestWithFinders < TestCaseClass
|
|
96
97
|
|
97
98
|
test "friendly_id slugs should be looked up from subclass with friendly" do
|
98
99
|
transaction do
|
99
|
-
editoralist = model_class.create! :
|
100
|
+
editoralist = model_class.create! name: "foo bar"
|
100
101
|
assert_equal editoralist, model_class.friendly.find(editoralist.slug)
|
101
102
|
end
|
102
103
|
end
|
103
104
|
|
104
105
|
test "friendly_id slugs should be looked up from subclass" do
|
105
106
|
transaction do
|
106
|
-
editoralist = model_class.create! :
|
107
|
+
editoralist = model_class.create! name: "foo bar"
|
107
108
|
assert_equal editoralist, model_class.find(editoralist.slug)
|
108
109
|
end
|
109
110
|
end
|
110
|
-
|
111
111
|
end
|
112
112
|
|
113
113
|
class StiTestSubClass < TestCaseClass
|
114
|
-
|
115
114
|
include FriendlyId::Test
|
116
115
|
|
117
116
|
class Journalist < ActiveRecord::Base
|
@@ -120,7 +119,7 @@ class StiTestSubClass < TestCaseClass
|
|
120
119
|
|
121
120
|
class Editorialist < Journalist
|
122
121
|
extend FriendlyId
|
123
|
-
friendly_id :name, :
|
122
|
+
friendly_id :name, use: [:slugged, :finders]
|
124
123
|
end
|
125
124
|
|
126
125
|
def model_class
|
@@ -129,9 +128,8 @@ class StiTestSubClass < TestCaseClass
|
|
129
128
|
|
130
129
|
test "friendly_id slugs can be created and looked up from subclass" do
|
131
130
|
transaction do
|
132
|
-
editoralist = model_class.create! :
|
131
|
+
editoralist = model_class.create! name: "foo bar"
|
133
132
|
assert_equal editoralist, model_class.find(editoralist.slug)
|
134
133
|
end
|
135
134
|
end
|
136
|
-
|
137
|
-
end
|
135
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norman Clarke
|
@@ -11,31 +11,33 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|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WQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1Ud
|
28
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUxRJaTQZmtkN8FKUWVHKc2riND18wHgYDVR0RBBcw
|
29
|
+
FYETcnVieWdlbXNAcC5hcm5kdC5pbzAeBgNVHRIEFzAVgRNydWJ5Z2Vtc0BwLmFy
|
30
|
+
bmR0LmlvMA0GCSqGSIb3DQEBCwUAA4IBgQBSRGMkZ2dvJ0LSjFz+rIt3G3AZMbKD
|
31
|
+
tjaaQRuC9rOkrl3Rml6h9j7cHYiM0wkTjXneFNySc8jWmM/jKnxiiUfUK9r1XL4n
|
32
|
+
71tz39+MD2lIpLVVEQ69MIoUseppNUTCg0mNghSDYNwISMD/hoWwbJudBi56DbhE
|
33
|
+
xkulLbw8qtcEE+iilIKibe+eJF4platKScsOA7d1AuilR1/S245UzeqwwyI52/xK
|
34
|
+
dfoP928X9Tb/48+83lWUgAgCQOd6WdfCpgQ5H6R90lc8L7OfuDR/vgcmSOTsNVgG
|
35
|
+
1TC3b2FISS0p0qfZsiS7BXh+ARoBKLXsV1a7WR36X0dUpajvk+zzBGrFCdbW43Gx
|
36
|
+
wmJzIksYnf9Ktg8Ux+FLcRBGw4qEIyWvqmS0obB1Hke68rTg0uNTFcKXsNw33XF5
|
37
|
+
fw1cbj95g7OPe0feGK8+afXh/L38vx/hIIOGlUEZ+HaWL2Dki/7vRGvda8dfOpG5
|
38
|
+
bJfaoyKbVsrK+gGKFJv860zsO8lg6BGLsUw=
|
37
39
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
40
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
39
41
|
dependencies:
|
40
42
|
- !ruby/object:Gem::Dependency
|
41
43
|
name: activerecord
|
@@ -163,10 +165,9 @@ dependencies:
|
|
163
165
|
- - ">="
|
164
166
|
- !ruby/object:Gem::Version
|
165
167
|
version: '0'
|
166
|
-
description:
|
167
|
-
|
168
|
-
|
169
|
-
strings as if they were numeric ids.
|
168
|
+
description: FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins
|
169
|
+
for Active Record. It lets you create pretty URLs and work with human-friendly strings
|
170
|
+
as if they were numeric ids.
|
170
171
|
email:
|
171
172
|
- norman@njclarke.com
|
172
173
|
- p@arndt.io
|
@@ -176,6 +177,7 @@ extra_rdoc_files: []
|
|
176
177
|
files:
|
177
178
|
- ".gemtest"
|
178
179
|
- ".github/FUNDING.yml"
|
180
|
+
- ".github/dependabot.yml"
|
179
181
|
- ".github/stale.yml"
|
180
182
|
- ".github/workflows/test.yml"
|
181
183
|
- ".gitignore"
|
@@ -192,6 +194,8 @@ files:
|
|
192
194
|
- friendly_id.gemspec
|
193
195
|
- gemfiles/Gemfile.rails-5.2.rb
|
194
196
|
- gemfiles/Gemfile.rails-6.0.rb
|
197
|
+
- gemfiles/Gemfile.rails-6.1.rb
|
198
|
+
- gemfiles/Gemfile.rails-7.0.rb
|
195
199
|
- guide.rb
|
196
200
|
- lib/friendly_id.rb
|
197
201
|
- lib/friendly_id/.gitattributes
|
@@ -207,6 +211,7 @@ files:
|
|
207
211
|
- lib/friendly_id/reserved.rb
|
208
212
|
- lib/friendly_id/scoped.rb
|
209
213
|
- lib/friendly_id/sequentially_slugged.rb
|
214
|
+
- lib/friendly_id/sequentially_slugged/calculator.rb
|
210
215
|
- lib/friendly_id/simple_i18n.rb
|
211
216
|
- lib/friendly_id/slug.rb
|
212
217
|
- lib/friendly_id/slug_generator.rb
|
@@ -253,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
258
|
- !ruby/object:Gem::Version
|
254
259
|
version: '0'
|
255
260
|
requirements: []
|
256
|
-
rubygems_version: 3.
|
261
|
+
rubygems_version: 3.3.7
|
257
262
|
signing_key:
|
258
263
|
specification_version: 4
|
259
264
|
summary: A comprehensive slugging and pretty-URL plugin.
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
j搉g6hDŽ���aQ�,��[�H�+P~M@ɈLO�z�!�TV�ٿ��>q|0T����ع|cDs1�`�����5�ϝd+��������\�:Ƶ���T��5��;�P��j]��h'�D�+�H-��@z}�,��WR) w���%�t�I�?L�4ɚ4K��뜂HI`4X
|