vidibus-permalink 1.1.4 → 1.2.0

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
- SHA1:
3
- metadata.gz: ad640ae4ba877c077d2bc5fce555b80e53ce0031
4
- data.tar.gz: 5f19f0c8dccc457029cdef8a96165d6ffe08317b
2
+ SHA256:
3
+ metadata.gz: 869d1b3a440875d2b182ea6df2f3575f38aa5458a286ff11661e8a91653fb034
4
+ data.tar.gz: 648d61de956b16a01c6369f47b67d63016911ed5f8c80673ddb859b1d68e33d5
5
5
  SHA512:
6
- metadata.gz: '0248ed6a753a7f733ee3427e9e06c247a49c0acf571caa11aad00bbc94cda1551cda1f362408151b68181e0ab30a58d087ca07b367c0f297d82b413077cd957e'
7
- data.tar.gz: 5f9554a661f83a7ec6c7f38622676f8a2824c8dd49a4337d872165c75dd516667368bfcf2601dfc9abb7bc2c8ae38c17a226bea8f802cf08c5b9e0bb96b7e23a
6
+ metadata.gz: 5c37bb3a960a133db1d65b8d82b49225d7edc5d0eadedfca4e70c3a65ff7448e8ac7f0d693d4d61cc0483c9dfb97a7e87bb59d39d0140b88053614e57e6d6a09
7
+ data.tar.gz: d3b8bb94709e024b1d577148e4ac14ad403e89c6ae56afdcdae8e3da48db19b7e534e6588d6f81f3142a04ca4e9821524540d56fd097f926da4bad4ad0365e73
@@ -47,7 +47,11 @@ class Permalink
47
47
  if current?
48
48
  self
49
49
  else
50
- Permalink.where(linkable_id: linkable.id, _current: true).first
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 = {linkable_id: linkable.id, _id: {'$ne' => id}}
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
@@ -1,5 +1,5 @@
1
1
  module Vidibus
2
2
  module Permalink
3
- VERSION = '1.1.4'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
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.1.4
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: 2019-12-03 00:00:00.000000000 Z
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
- rubyforge_project:
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