sluggable_david 0.0.1
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.
- checksums.yaml +7 -0
- data/lib/sluggable_david.rb +24 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6fdfe10a47d1b8cfafce6cca22176a083f533b1
|
4
|
+
data.tar.gz: 3c0651eaa10728ac9997b946a49cd695ddab9d84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51c0abc951e2836e85db85b7800780fe18268c2f2d007ca14599ba63ec4d74589b8ec751004096326c2442e87f7f7336a70f5af9977a5350163455e501b90592
|
7
|
+
data.tar.gz: 2a5b8a51811bc1e7e25b65eff379d61d401fa9a7197637e951ba17ffa429688f45b132915c4d650635a6608f5e563cfd10c72948506486d0fadc13d7be98bb9f
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Sluggable
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
after_validation :set_slug
|
5
|
+
class_attribute :slug_column
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def set_slug_column(col_name)
|
10
|
+
self.slug_column = col_name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_param
|
15
|
+
self.slug
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def set_slug
|
21
|
+
self.slug = self.send(self.class.slug_column.to_sym).gsub(" ", "-").downcase
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sluggable_david
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Hou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Tealeaf homework
|
14
|
+
email: htw0819@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/sluggable_david.rb
|
20
|
+
homepage: https://github.com/llmonkey/sluggable_david
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.2.0
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A gem for slug
|
43
|
+
test_files: []
|
44
|
+
has_rdoc:
|