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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/slugable.rb +9 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTY2MTA5N2FiZmI5Y2ZhOWVkOWI0Y2YyZTgyNmRkNmFkYTIxMWZiYg==
4
+ YjMzNWE5OGNjZjA3YTFlOTBlNjUzYmVmMzRkODNhODQwOTI2Yzg1OQ==
5
5
  data.tar.gz: !binary |-
6
- MGExZjgzMjRlODg2NTk3OGViYWEyNjEyNzUxN2JiZWQzNjQxMmM4ZA==
6
+ N2Q4ODI0ZDRjNzhlOTVkZjE5NDEyYzQ3NGRjMGJlYmMwMjlhZThhYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWUyNWRhNGM1NmI1ZDc4OWQ5YmJjNjQ5MTk5NjI2MDIxYmMzZTc1NTUzYTAw
10
- MzQxMzBiYmU5YTg0NzE0MTc2OTg1ZjUxYWQ0ZGNkN2QzY2UxMjE3MzdmYzNk
11
- YTFkZmI1ZDU2ZmMzOTQzN2JiMDljZDRiNzcxNWUzZjlmYThhMDA=
9
+ NDY5MDEzOTE2YjZiOWZkNzlmNTJiNDljYmQ5ODI4NTlkMmI1YjAwNDIzZWU2
10
+ MzAxOTRjNWU5MzM3MTUzZmYxOTM0MDNlNTE1YTNkNjkwODcwY2U1ZGQ4NDQ0
11
+ MmY4YzBkNmM3ZDY0M2U5OTdjYWY0YmQ5MDkyN2RiMDA4YjM4Mjg=
12
12
  data.tar.gz: !binary |-
13
- NTZmNDQyMWIwNTgxNjVjM2ExNGQ3MjFiYWE0NGIyZWE4ODUwOWZiYTdkMDhh
14
- NGM4YmNlZWNkYWRkOGIzZjQyYTZmMjQyNWQ2YmM2ODM1ODVmOTgxOTVjNGIw
15
- NzlkMjlmNWRiZmQ2M2M0ODQ4ZjU4NzBjMDczYjAzYzk4YjMxNzk=
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) You will need to include a to_param method, in order to generate the slug, as follows:
10
+ # (2) Ensure that you have a column called "slug" in your model.
11
11
  #
12
- # def to_param
13
- # self.slug
14
- # end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugable-joe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Levinger