acts_as_nice_url 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/init.rb +1 -0
- data/lib/nice_url.rb +1 -12
- data/test/nice_url_test.rb +4 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'rubyforge'
|
|
6
6
|
|
7
7
|
SPEC = Gem::Specification.new do |s|
|
8
8
|
s.name = 'acts_as_nice_url'
|
9
|
-
s.version = '
|
9
|
+
s.version = '2.0.0'
|
10
10
|
s.authors = ['Nicolas Cavigneaux']
|
11
11
|
s.email = 'nico@bounga.org'
|
12
12
|
s.homepage = 'http://www.bitbucket.org/Bounga/acts_as_nice_url'
|
@@ -19,7 +19,7 @@ SPEC = Gem::Specification.new do |s|
|
|
19
19
|
s.has_rdoc = true
|
20
20
|
s.extra_rdoc_files = ['README']
|
21
21
|
s.require_paths = ["lib"]
|
22
|
-
s.add_dependency('activerecord')
|
22
|
+
s.add_dependency('activerecord', '>=2.2.0')
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'run unit tests'
|
data/init.rb
CHANGED
data/lib/nice_url.rb
CHANGED
@@ -42,18 +42,7 @@ module Bounga
|
|
42
42
|
# All the methods available to a record that has had <tt>acts_as_nice_url</tt> specified.
|
43
43
|
module InstanceMethods
|
44
44
|
def to_param
|
45
|
-
|
46
|
-
s = Iconv.new('us-ascii//TRANSLIT', 'utf-8').iconv(nice_title.to_s).strip.downcase
|
47
|
-
# Remove spaces
|
48
|
-
s = s.gsub(/\s+/, '-')
|
49
|
-
# Replace dots
|
50
|
-
s = s.gsub('.', '-')
|
51
|
-
# Remove reserved characters
|
52
|
-
s = s.gsub(/[^a-z0-9\-]/, '')
|
53
|
-
# Remove multiple dashes
|
54
|
-
s = s.gsub(/([\-]){2,}/, '\1')
|
55
|
-
# Remove ending dashes
|
56
|
-
s = s.gsub(/[\-]+$/, '')
|
45
|
+
s = nice_title.to_s.parameterize
|
57
46
|
|
58
47
|
if nice_id
|
59
48
|
s = [self.id, s].join('-')
|
data/test/nice_url_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_nice_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Cavigneaux
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 2.2.0
|
24
24
|
version:
|
25
25
|
description: This Ruby on Rails acts_as extension provides the capabilities for creating a nice url based on an attribute of the current object. You can set / unset the object id in front of the URL and choose the object attribute to use to generate the URL.
|
26
26
|
email: nico@bounga.org
|