railhead_permalink 0.1.20 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c45bacad90eee842185fdaf40032c86137969288
4
- data.tar.gz: 3516d607f05ca2652f1233ebc40d66f0ce3bef28
3
+ metadata.gz: ed42432ef2afd049a02671146eb520e6cc08faf5
4
+ data.tar.gz: b5a9a4973ab339ef115748ca41f149503973522f
5
5
  SHA512:
6
- metadata.gz: 8a3f3928b06a98c57155c54f278af0e121ac448ddbda55c6228fe32c1a8e9f048f86d4708212f4132d519ad12b9d001da1897aeac46db846f289f7865e971a59
7
- data.tar.gz: bd0e074bafbca898a83353d4c0b728a421a04c6b1010e17864f4c7dba55de19000a50e59c3f25ad4efee9a62af435d18920ab91d51ec5b069f1c9c4a5ee4b1bd
6
+ metadata.gz: d378d36a8db3c4781dfc6f175983ea0648387bb21194bc3a33d13338c4b917b9bb9e041070b5d385149be05b4ef0edc8cd4f54ebeb840b248a59a844c2bcc5e7
7
+ data.tar.gz: 058dc295b1670a065f587a148b2e8a867cc84314bfaa6317be182cc170f7a396eed889af9887d1882391f86639534d9b2c592be5714976c2d62d69455b83c0b4
@@ -1,11 +1,23 @@
1
+ begin
2
+ require 'stringex_lite'
3
+ rescue LoadError
4
+ class String
5
+ alias_method :to_url, :parameterize
6
+ end
7
+ end
8
+
9
+
1
10
  module RailheadPermalink
11
+
2
12
  def self.included(base)
3
13
  base.class_eval do
4
14
  extend ClassMethods
5
15
  end
6
16
  end
7
17
 
18
+
8
19
  module ClassMethods
20
+
9
21
  def auto_permalink(field, options = {})
10
22
  include RailheadPermalink::InstanceMethods
11
23
  class << self
@@ -35,10 +47,12 @@ module RailheadPermalink
35
47
  end
36
48
  end
37
49
 
50
+
38
51
  module InstanceMethods
52
+
39
53
  def create_permalink
40
54
  if self.permalink.nil? or (self.changed.include?(permalink_options[:field].to_s) and not permalink_options[:keep_existing])
41
- key = self[permalink_options[:field]].parameterize.to_s
55
+ key = self[permalink_options[:field]].to_url
42
56
  unless self.permalink == key
43
57
  permalink, counter = key, '-1'
44
58
  while permalink_options[:reserved_names].include?(permalink) or permalink.blank? or
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "railhead_permalink"
3
- s.version = "0.1.20"
4
- s.date = "2013-11-24"
3
+ s.version = "0.2.0"
4
+ s.date = "2014-10-24"
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railhead_permalink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bence Nagy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-24 00:00:00.000000000 Z
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RailheadPermalink is a Ruby on Rails plugin that automatically finds
14
14
  ActiveRecord objects with permalink.
@@ -21,30 +21,30 @@ files:
21
21
  - MIT-LICENSE
22
22
  - README.rdoc
23
23
  - init.rb
24
- - railhead_permalink.gemspec
25
24
  - lib/railhead_permalink.rb
25
+ - railhead_permalink.gemspec
26
26
  homepage: http://github.com/nagybence/railhead_permalink
27
27
  licenses: []
28
28
  metadata: {}
29
29
  post_install_message:
30
30
  rdoc_options:
31
- - --main
31
+ - "--main"
32
32
  - README.rdoc
33
33
  require_paths:
34
34
  - lib
35
35
  required_ruby_version: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '>='
42
+ - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: '0'
45
45
  requirements: []
46
46
  rubyforge_project:
47
- rubygems_version: 2.0.6
47
+ rubygems_version: 2.2.2
48
48
  signing_key:
49
49
  specification_version: 4
50
50
  summary: RailheadPermalink is a Ruby on Rails plugin that automatically finds ActiveRecord