vidibus-permalink 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/permalink.rb +5 -6
- data/lib/vidibus/permalink/mongoid.rb +2 -2
- data/lib/vidibus/permalink/version.rb +1 -1
- metadata +11 -11
data/app/models/permalink.rb
CHANGED
@@ -17,7 +17,7 @@ class Permalink
|
|
17
17
|
validates :linkable_uuid, :uuid => true
|
18
18
|
validates :value, :linkable_class, :presence => true
|
19
19
|
|
20
|
-
index :
|
20
|
+
index value: 1
|
21
21
|
|
22
22
|
# Sets object as linkable.
|
23
23
|
def linkable=(obj)
|
@@ -144,6 +144,7 @@ class Permalink
|
|
144
144
|
def increment(string)
|
145
145
|
_existing = existing(string)
|
146
146
|
return string unless _existing.any?
|
147
|
+
return string unless _existing.detect {|e| e.value == string}
|
147
148
|
number = 1
|
148
149
|
while true
|
149
150
|
number += 1
|
@@ -166,11 +167,9 @@ class Permalink
|
|
166
167
|
return unless linkable
|
167
168
|
conditions = {:linkable_uuid => linkable_uuid, :_id => {"$ne" => _id}}
|
168
169
|
conditions[:scope] = Permalink.scope_list(scope) if scope.present?
|
169
|
-
collection.
|
170
|
-
conditions
|
171
|
-
{
|
172
|
-
{:multi => true}
|
173
|
-
)
|
170
|
+
collection.
|
171
|
+
find(conditions).
|
172
|
+
update({'$set' => {_current: false}}, {multi: true})
|
174
173
|
end
|
175
174
|
|
176
175
|
# Sets the lastly updated permalink of the assigned linkable as current one.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-permalink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3'
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3'
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '3'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
45
|
+
version: '3'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: vidibus-core_extensions
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
69
|
+
version: '0'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0
|
77
|
+
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: vidibus-words
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
segments:
|
219
219
|
- 0
|
220
|
-
hash: -
|
220
|
+
hash: -3383487206857057643
|
221
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
222
|
none: false
|
223
223
|
requirements:
|