sluggable_finder 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/sluggable_finder/orm.rb +3 -2
- data/lib/sluggable_finder/version.rb +1 -1
- data/spec/sluggable_finder_spec.rb +4 -4
- metadata +24 -24
data/Gemfile.lock
CHANGED
data/lib/sluggable_finder/orm.rb
CHANGED
@@ -78,7 +78,8 @@ module SluggableFinder
|
|
78
78
|
def get_value_or_generate_random(column_name)
|
79
79
|
v = self.send(column_name)
|
80
80
|
v = sluggable_finder_options[:slug_modifier].call(v) if sluggable_finder_options[:slug_modifier]
|
81
|
-
|
81
|
+
encoded = SluggableFinder.encode(v.to_s)
|
82
|
+
(v.present? && encoded.present?) ? v : SluggableFinder.random_slug_for(self.class)
|
82
83
|
end
|
83
84
|
|
84
85
|
def create_sluggable_slug
|
@@ -120,4 +121,4 @@ module SluggableFinder
|
|
120
121
|
end
|
121
122
|
|
122
123
|
end
|
123
|
-
end
|
124
|
+
end
|
@@ -104,7 +104,7 @@ describe "SluggableFinder" do
|
|
104
104
|
it "should connect to test sqlite db" do
|
105
105
|
Item.count.should == 3
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
it "should create unique slugs" do
|
109
109
|
@item.slug.should == 'hello-world'
|
110
110
|
@item2.slug.should == 'hello-world-2'
|
@@ -143,8 +143,8 @@ describe "SluggableFinder" do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should store random slug if field is nil" do
|
146
|
-
|
147
|
-
|
146
|
+
SimpleItem.create!(:title => nil).to_param.should_not be_blank
|
147
|
+
SimpleItem.create(:title => '.').to_param.should_not be_blank
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -386,4 +386,4 @@ describe "SluggableFinder" do
|
|
386
386
|
@sti2.slug.should == 'slug'
|
387
387
|
end
|
388
388
|
end
|
389
|
-
end
|
389
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sluggable_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 4
|
10
|
+
version: 2.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ismael Celis
|
@@ -15,12 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2014-07-11 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
@@ -31,12 +30,12 @@ dependencies:
|
|
31
30
|
- 0
|
32
31
|
- 0
|
33
32
|
version: 1.0.0
|
34
|
-
|
35
|
-
name: bundler
|
33
|
+
requirement: *id001
|
36
34
|
prerelease: false
|
37
|
-
|
35
|
+
name: bundler
|
38
36
|
type: :development
|
39
|
-
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
@@ -45,12 +44,12 @@ dependencies:
|
|
45
44
|
segments:
|
46
45
|
- 0
|
47
46
|
version: "0"
|
48
|
-
|
49
|
-
name: rspec
|
47
|
+
requirement: *id002
|
50
48
|
prerelease: false
|
51
|
-
|
49
|
+
name: rspec
|
52
50
|
type: :development
|
53
|
-
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
53
|
none: false
|
55
54
|
requirements:
|
56
55
|
- - ">="
|
@@ -59,12 +58,12 @@ dependencies:
|
|
59
58
|
segments:
|
60
59
|
- 0
|
61
60
|
version: "0"
|
62
|
-
|
63
|
-
name: rake
|
61
|
+
requirement: *id003
|
64
62
|
prerelease: false
|
65
|
-
|
63
|
+
name: rake
|
66
64
|
type: :development
|
67
|
-
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
67
|
none: false
|
69
68
|
requirements:
|
70
69
|
- - ">="
|
@@ -73,12 +72,12 @@ dependencies:
|
|
73
72
|
segments:
|
74
73
|
- 0
|
75
74
|
version: "0"
|
76
|
-
|
77
|
-
name: sqlite3
|
75
|
+
requirement: *id004
|
78
76
|
prerelease: false
|
77
|
+
name: sqlite3
|
78
|
+
type: :development
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
|
81
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
82
81
|
none: false
|
83
82
|
requirements:
|
84
83
|
- - <=
|
@@ -89,9 +88,10 @@ dependencies:
|
|
89
88
|
- 8
|
90
89
|
- 0
|
91
90
|
version: 2.8.0
|
92
|
-
|
93
|
-
name: activerecord
|
91
|
+
requirement: *id005
|
94
92
|
prerelease: false
|
93
|
+
name: activerecord
|
94
|
+
type: :runtime
|
95
95
|
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.
|
96
96
|
email:
|
97
97
|
- ismaelct@gmail.com
|