slugable-joe 0.0.2 → 0.0.3
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 +8 -8
- data/lib/slugable.rb +9 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjMzNWE5OGNjZjA3YTFlOTBlNjUzYmVmMzRkODNhODQwOTI2Yzg1OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2Q4ODI0ZDRjNzhlOTVkZjE5NDEyYzQ3NGRjMGJlYmMwMjlhZThhYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDY5MDEzOTE2YjZiOWZkNzlmNTJiNDljYmQ5ODI4NTlkMmI1YjAwNDIzZWU2
|
10
|
+
MzAxOTRjNWU5MzM3MTUzZmYxOTM0MDNlNTE1YTNkNjkwODcwY2U1ZGQ4NDQ0
|
11
|
+
MmY4YzBkNmM3ZDY0M2U5OTdjYWY0YmQ5MDkyN2RiMDA4YjM4Mjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTI4MDE4MTc2MTZlYzEwZTlmNzA3YmRlOWRiYTgyOGQ2ZGJiNzUyZWY2NDJj
|
14
|
+
ZTJhYmUzZDk3NDkwZTY2ZDJhMjdmZjYzNzkwZTI2NmQ4OTg4ZDJhYjU2OTEz
|
15
|
+
NWIxYmE3OGVmNWIxZTI2YTA5Yzg0MDhiMTQ2OTM5MTFmNTk5ODU=
|
data/lib/slugable.rb
CHANGED
@@ -7,19 +7,18 @@
|
|
7
7
|
# include the following line of code within the file that is invoking the gem:
|
8
8
|
# alias_attribute :slug_string, :title
|
9
9
|
#
|
10
|
-
# (2)
|
10
|
+
# (2) Ensure that you have a column called "slug" in your model.
|
11
11
|
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# You can then reference to_param in your view to print out the URL containing the slug.
|
17
|
-
#
|
18
|
-
# (3) You will want to use the before_save ActiveRecord Callback, as follows:
|
19
|
-
#
|
20
|
-
# before_save :generate_slug
|
12
|
+
# (3) Include the following line of code in your application.rb file:
|
13
|
+
#
|
14
|
+
# require 'slugable'
|
21
15
|
|
22
16
|
module Slugable
|
17
|
+
|
18
|
+
included do
|
19
|
+
before_save :generate_slug
|
20
|
+
end
|
21
|
+
|
23
22
|
def generate_slug
|
24
23
|
if self.errors.empty?
|
25
24
|
#strip the string
|