vidibus-permalink 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/models/permalink.rb +12 -4
- data/lib/vidibus/permalink/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 869d1b3a440875d2b182ea6df2f3575f38aa5458a286ff11661e8a91653fb034
|
4
|
+
data.tar.gz: 648d61de956b16a01c6369f47b67d63016911ed5f8c80673ddb859b1d68e33d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c37bb3a960a133db1d65b8d82b49225d7edc5d0eadedfca4e70c3a65ff7448e8ac7f0d693d4d61cc0483c9dfb97a7e87bb59d39d0140b88053614e57e6d6a09
|
7
|
+
data.tar.gz: d3b8bb94709e024b1d577148e4ac14ad403e89c6ae56afdcdae8e3da48db19b7e534e6588d6f81f3142a04ca4e9821524540d56fd097f926da4bad4ad0365e73
|
data/app/models/permalink.rb
CHANGED
@@ -47,7 +47,11 @@ class Permalink
|
|
47
47
|
if current?
|
48
48
|
self
|
49
49
|
else
|
50
|
-
Permalink.where(
|
50
|
+
Permalink.where({
|
51
|
+
linkable_id: linkable.id,
|
52
|
+
linkable_type: linkable.class.to_s,
|
53
|
+
_current: true
|
54
|
+
}).first
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
@@ -61,7 +65,7 @@ class Permalink
|
|
61
65
|
class << self
|
62
66
|
# Scope method for finding Permalinks for given object.
|
63
67
|
def for_linkable(object)
|
64
|
-
where(linkable_id: object.id)
|
68
|
+
where(linkable_id: object.id, linkable_type: object.class.to_s)
|
65
69
|
end
|
66
70
|
|
67
71
|
# Scope method for finding Permalinks for given value.
|
@@ -154,7 +158,11 @@ class Permalink
|
|
154
158
|
# Sets _current to false on all permalinks of the assigned linkable.
|
155
159
|
def unset_other_current
|
156
160
|
return unless linkable
|
157
|
-
conditions = {
|
161
|
+
conditions = {
|
162
|
+
linkable_id: linkable.id,
|
163
|
+
linkable_type: linkable.class.to_s,
|
164
|
+
_id: {'$ne' => id}
|
165
|
+
}
|
158
166
|
conditions[:scope] = Permalink.scope_list(scope) if scope.present?
|
159
167
|
Permalink.where(conditions).each do |obj|
|
160
168
|
obj.set(_current: false)
|
@@ -164,7 +172,7 @@ class Permalink
|
|
164
172
|
# Sets the lastly updated permalink of the assigned linkable as current one.
|
165
173
|
def set_last_current
|
166
174
|
last = Permalink
|
167
|
-
.where(linkable_id: linkable.id)
|
175
|
+
.where(linkable_id: linkable.id, linkable_type: linkable.class.to_s)
|
168
176
|
.order_by(:updated_at.desc)
|
169
177
|
.limit(1)
|
170
178
|
.first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-permalink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Pankratz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -184,8 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: 1.3.6
|
186
186
|
requirements: []
|
187
|
-
|
188
|
-
rubygems_version: 2.6.11
|
187
|
+
rubygems_version: 3.0.6
|
189
188
|
signing_key:
|
190
189
|
specification_version: 4
|
191
190
|
summary: Permalink handling
|