nagybence-railhead_permalink 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/railhead_permalink.rb +2 -3
- data/railhead_permalink.gemspec +1 -1
- metadata +1 -1
data/lib/railhead_permalink.rb
CHANGED
@@ -19,9 +19,8 @@ module RailheadPermalink
|
|
19
19
|
:reserved_names => (options[:reserved_names] || []).concat(ActionController::Base.resources_path_names.values)
|
20
20
|
})
|
21
21
|
|
22
|
-
|
22
|
+
before_save :create_permalink
|
23
23
|
validates_presence_of field
|
24
|
-
validates_presence_of :permalink
|
25
24
|
end
|
26
25
|
|
27
26
|
def find_with_permalink(*args)
|
@@ -40,7 +39,7 @@ module RailheadPermalink
|
|
40
39
|
key, counter = self[permalink_options[:field]].parameterize.to_s, '-1'
|
41
40
|
unless self.permalink == key
|
42
41
|
permalink = key
|
43
|
-
while permalink_options[:reserved_names].include?(permalink) or
|
42
|
+
while permalink_options[:reserved_names].include?(permalink) or permalink.blank? or
|
44
43
|
(self.class.exists?(:permalink => permalink) and not self == self.class.find_without_permalink(:first, :conditions => {:permalink => permalink}))
|
45
44
|
counter.succ!
|
46
45
|
permalink = key + counter
|
data/railhead_permalink.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "railhead_permalink"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.11"
|
4
4
|
s.date = "2009-03-12"
|
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"
|