nagybence-railhead_permalink 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/railhead_permalink.rb +7 -5
- data/railhead_permalink.gemspec +2 -2
- metadata +2 -2
data/lib/railhead_permalink.rb
CHANGED
@@ -37,12 +37,14 @@ module RailheadPermalink
|
|
37
37
|
def create_permalink
|
38
38
|
if self.permalink.nil? or not permalink_options[:keep_existing]
|
39
39
|
key, counter = self[permalink_options[:field]].parameterize.to_s, '-1'
|
40
|
-
permalink
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
unless self.permalink == key
|
41
|
+
permalink = key
|
42
|
+
while permalink_options[:reserved_names].include?(permalink) or self.class.exists?(:permalink => permalink)
|
43
|
+
counter.succ!
|
44
|
+
permalink = key + counter
|
45
|
+
end
|
46
|
+
self[:permalink] = permalink
|
44
47
|
end
|
45
|
-
self[:permalink] = permalink
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
data/railhead_permalink.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "railhead_permalink"
|
3
|
-
s.version = "0.1.
|
4
|
-
s.date = "2009-01-
|
3
|
+
s.version = "0.1.6"
|
4
|
+
s.date = "2009-01-28"
|
5
5
|
s.summary = "RailheadPermalink is a Ruby on Rails plugin that automatically finds ActiveRecord objects with permalink."
|
6
6
|
s.email = "nagybence@tipogral.hu"
|
7
7
|
s.homepage = "http://github.com/nagybence/railhead_permalink"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nagybence-railhead_permalink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bence Nagy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-28 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|