friendly_id-mobility 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +17 -13
- data/lib/friendly_id/mobility.rb +1 -2
- data/lib/friendly_id/mobility/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e899ca7fccbde715e312d131d3234c507fb388c11ae6cf2fea9aca0d07b18c
|
4
|
+
data.tar.gz: d179dda1a53c65d19aa094e9af3f8450bf385e2293d5ec84a54b643ca72a6d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30cdda75e3850bc631f5197683c0b4fbdb7ada21c3b5203dc11043f896ce616730d44e0f7468073970f7bf0dd51f61a7033d02c776a9e635ea05a5d6f8c780f
|
7
|
+
data.tar.gz: cc19d88058cda9ea0dbaf6ddde380ca7533c9289fa4194e464d7cf8d0959a6cae47e436f8d2a166b8e1fa8a1bceec7d5793ed103078882b28779a613a8a36ccc
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## 1.0
|
4
4
|
|
5
|
+
### 1.0.2
|
6
|
+
|
7
|
+
* Depend on Mobility 1.0.1 to avoid need for `const_get`
|
8
|
+
([#25](https://github.com/shioyama/friendly_id-mobility/pull/25/files))
|
9
|
+
|
5
10
|
### 1.0.1
|
6
11
|
|
7
12
|
* Update friendly_id dependency ([#21](https://github.com/shioyama/friendly_id-mobility/pull/21))
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Installation
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem 'friendly_id-mobility', '~> 1.0.
|
21
|
+
gem 'friendly_id-mobility', '~> 1.0.2'
|
22
22
|
```
|
23
23
|
|
24
24
|
And then execute:
|
@@ -27,19 +27,27 @@ And then execute:
|
|
27
27
|
bundle
|
28
28
|
```
|
29
29
|
|
30
|
-
|
30
|
+
Then run the Mobility generator:
|
31
31
|
|
32
32
|
```
|
33
|
-
|
33
|
+
rails generate mobility:install
|
34
34
|
```
|
35
35
|
|
36
|
-
|
36
|
+
This will generate an initializer for Mobility. To ensure that FriendlyId sees
|
37
|
+
changes correctly on attributes, enable (uncomment) the `dirty` plugin line in
|
38
|
+
your Mobility configuration:
|
37
39
|
|
38
|
-
```
|
39
|
-
|
40
|
+
```ruby
|
41
|
+
Mobility.configure do
|
42
|
+
plugins do
|
43
|
+
# ...
|
44
|
+
dirty
|
45
|
+
# ...
|
46
|
+
end
|
47
|
+
end
|
40
48
|
```
|
41
49
|
|
42
|
-
|
50
|
+
Next, run the FriendlyId generator:
|
43
51
|
|
44
52
|
```
|
45
53
|
rails generate friendly_id
|
@@ -99,7 +107,7 @@ You can also translate both slug and base attribute:
|
|
99
107
|
```ruby
|
100
108
|
class Article < ActiveRecord::Base
|
101
109
|
extend Mobility
|
102
|
-
translates :slug, :title
|
110
|
+
translates :slug, :title
|
103
111
|
|
104
112
|
extend FriendlyId
|
105
113
|
friendly_id :title, use: :mobility
|
@@ -125,10 +133,6 @@ article.slug
|
|
125
133
|
#=> "my-foo-title"
|
126
134
|
```
|
127
135
|
|
128
|
-
Setting `dirty: true` on the translated base attribute is recommended in order
|
129
|
-
to ensure that changes in any locale trigger updates to the slug in that
|
130
|
-
locale.
|
131
|
-
|
132
136
|
### Friendly Finders with Translated Attributes
|
133
137
|
|
134
138
|
The Mobility `i18n` scope is mixed into the `friendly` scope for models which
|
@@ -156,7 +160,7 @@ calling `friendly_id` from your model:
|
|
156
160
|
```ruby
|
157
161
|
class Article < ActiveRecord::Base
|
158
162
|
extend Mobility
|
159
|
-
translates :slug, :title
|
163
|
+
translates :slug, :title
|
160
164
|
|
161
165
|
extend FriendlyId
|
162
166
|
friendly_id :title, use: [:history, :mobility]
|
data/lib/friendly_id/mobility.rb
CHANGED
@@ -23,8 +23,7 @@ module FriendlyId
|
|
23
23
|
|
24
24
|
mod = Module.new do
|
25
25
|
def friendly
|
26
|
-
|
27
|
-
super.extending(::Mobility::Plugins::ActiveRecord::Query.const_get(:QueryExtension))
|
26
|
+
super.extending(::Mobility::Plugins::ActiveRecord::Query::QueryExtension)
|
28
27
|
end
|
29
28
|
end
|
30
29
|
model_class.send :extend, mod
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_id-mobility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mobility
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.
|
19
|
+
version: 1.0.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.
|
29
|
+
version: 1.0.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2.0'
|