nagybence-railhead_permalink 0.1.7 → 0.1.8

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