sluggable_finder 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +3 -2
- data/lib/sluggable_finder/orm.rb +3 -1
- data/sluggable_finder.gemspec +6 -5
- data/spec/sluggable_finder_spec.rb +12 -0
- metadata +20 -9
data/VERSION.yml
CHANGED
data/lib/sluggable_finder/orm.rb
CHANGED
@@ -19,7 +19,8 @@ module SluggableFinder
|
|
19
19
|
:scope => nil,
|
20
20
|
:to => :slug,
|
21
21
|
:reserved_slugs => [],
|
22
|
-
:allow_integer_ids => true
|
22
|
+
:allow_integer_ids => true,
|
23
|
+
:upcase => false
|
23
24
|
}.merge( options ))
|
24
25
|
class_inheritable_reader :sluggable_finder_options
|
25
26
|
|
@@ -85,6 +86,7 @@ module SluggableFinder
|
|
85
86
|
else
|
86
87
|
SluggableFinder.encode get_value_or_generate_random(destination_column.to_sym) # self.slug
|
87
88
|
end
|
89
|
+
proposed_slug = proposed_slug.upcase if sluggable_finder_options[:upcase]
|
88
90
|
rescue Exception => e
|
89
91
|
raise e
|
90
92
|
end
|
data/sluggable_finder.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sluggable_finder}
|
8
|
-
s.version = "2.2.
|
8
|
+
s.version = "2.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ismael Celis"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-06-11}
|
13
13
|
s.description = %q{This plugin allows models to generate a unique "slug" (url-enabled name) from any regular attribute. Add friendly URLs to your models with one line.}
|
14
14
|
s.email = %q{ismaelct@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.homepage = %q{http://github.com/ismasan/sluggable-finder}
|
42
42
|
s.rdoc_options = ["--charset=UTF-8"]
|
43
43
|
s.require_paths = ["lib"]
|
44
|
-
s.rubygems_version = %q{1.3.
|
44
|
+
s.rubygems_version = %q{1.3.6}
|
45
45
|
s.summary = %q{Easy friendly URLs for your ActiveRecord models}
|
46
46
|
s.test_files = [
|
47
47
|
"spec/sluggable_finder_spec.rb",
|
@@ -61,3 +61,4 @@ Gem::Specification.new do |s|
|
|
61
61
|
s.add_dependency(%q<activerecord>, [">= 2.2.2"])
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
@@ -30,6 +30,10 @@ class SimpleItem < Item
|
|
30
30
|
sluggable_finder :title, :reserved_slugs => ['admin','settings'] # defaults :to => :slug
|
31
31
|
end
|
32
32
|
|
33
|
+
class SimpleUpcaseItem < Item
|
34
|
+
sluggable_finder :title, :upcase => true
|
35
|
+
end
|
36
|
+
|
33
37
|
class StringOnlyItem < Item
|
34
38
|
sluggable_finder :title, :allow_integer_ids => false
|
35
39
|
end
|
@@ -129,6 +133,14 @@ describe "SluggableFinder" do
|
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
136
|
+
describe SimpleUpcaseItem, 'uppercase slugs' do
|
137
|
+
|
138
|
+
it 'should uppercase slugs' do
|
139
|
+
item = SimpleUpcaseItem.create!(:title => 'tHis Should be Capitalized 1977')
|
140
|
+
item.to_param.should == 'THIS-SHOULD-BE-CAPITALIZED-1977'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
132
144
|
describe ':allow_integer_ids => false' do
|
133
145
|
|
134
146
|
before do
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sluggable_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 2
|
8
|
+
- 2
|
9
|
+
version: 2.2.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Ismael Celis
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-06-11 00:00:00 +01:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: activerecord
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 2
|
30
|
+
- 2
|
23
31
|
version: 2.2.2
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
description: This plugin allows models to generate a unique "slug" (url-enabled name) from any regular attribute. Add friendly URLs to your models with one line.
|
26
35
|
email: ismaelct@gmail.com
|
27
36
|
executables: []
|
@@ -65,18 +74,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
74
|
requirements:
|
66
75
|
- - ">="
|
67
76
|
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 0
|
68
79
|
version: "0"
|
69
|
-
version:
|
70
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
81
|
requirements:
|
72
82
|
- - ">="
|
73
83
|
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
74
86
|
version: "0"
|
75
|
-
version:
|
76
87
|
requirements: []
|
77
88
|
|
78
89
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.3.
|
90
|
+
rubygems_version: 1.3.6
|
80
91
|
signing_key:
|
81
92
|
specification_version: 3
|
82
93
|
summary: Easy friendly URLs for your ActiveRecord models
|