slugger 0.1.1 → 0.2.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/VERSION +1 -1
- data/lib/slugger.rb +0 -15
- data/spec/lib/edge_spec.rb +0 -1
- data/spec/schema.rb +0 -1
- metadata +5 -5
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.2.0
|
data/lib/slugger.rb
CHANGED
|
@@ -12,7 +12,6 @@ module Slugger
|
|
|
12
12
|
default_options = {
|
|
13
13
|
:title_column => 'title',
|
|
14
14
|
:slug_column => 'slug',
|
|
15
|
-
:as_param => true,
|
|
16
15
|
:substitution_char => '-',
|
|
17
16
|
:downcase => true,
|
|
18
17
|
:on_conflict => :error
|
|
@@ -36,26 +35,12 @@ module Slugger
|
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
send :define_method, :column_to_slug, lambda { self.send(slugger_options[:title_column]) }
|
|
39
|
-
|
|
40
|
-
class << self
|
|
41
|
-
def find(*args)
|
|
42
|
-
if self.slugger_options[:as_param] && args.first.is_a?(String)
|
|
43
|
-
find_by_slug(args)
|
|
44
|
-
else
|
|
45
|
-
super(*args)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
38
|
|
|
50
39
|
include InstanceMethods
|
|
51
40
|
end
|
|
52
41
|
end
|
|
53
42
|
module InstanceMethods
|
|
54
43
|
|
|
55
|
-
def to_param
|
|
56
|
-
slugger_options[:as_param] ? self.slug : self.id
|
|
57
|
-
end
|
|
58
|
-
|
|
59
44
|
protected
|
|
60
45
|
|
|
61
46
|
def permalize
|
data/spec/lib/edge_spec.rb
CHANGED
data/spec/schema.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slugger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 2
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.2.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Seth Faxon
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-08-
|
|
18
|
+
date: 2011-08-28 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: activerecord
|