manual_slug 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/manual_slug/active_record.rb +6 -1
- data/lib/manual_slug/mongoid.rb +7 -1
- data/lib/manual_slug/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39d21e04468bf80aee597c2517b8ac4c466178152a1c3d8bbdd084f03d06f64a
|
4
|
+
data.tar.gz: 6c7151f188c747b00e7cce2b7661e8703dcad4cf2b6e65ce88d5990391ba1080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8660e413daad102ee275453784c5de40e6d041d56ef064a78b4c5d66621118cb9d74df49ce077e072c86767d5d360dc66711c29e9144c6b305b00f574065fc10
|
7
|
+
data.tar.gz: b22ffa53afe18af5f8df5b073789b8cf1d8b4907802a04d61c1c7ff33c70736879b1e6110db1c10665f73ab23e0bb6575bb98a6da691dcd592649a0ac37ba186
|
@@ -14,7 +14,12 @@ module ManualSlug::ActiveRecord
|
|
14
14
|
|
15
15
|
module ClassMethods
|
16
16
|
def manual_slug(field, options = {}, callback = true)
|
17
|
-
|
17
|
+
unless options.key?(:use)
|
18
|
+
options[:use] = [:slugged, :finders]
|
19
|
+
end
|
20
|
+
|
21
|
+
friendly_id field, options
|
22
|
+
|
18
23
|
define_method(:should_generate_new_friendly_id?) do
|
19
24
|
slug.blank?
|
20
25
|
end
|
data/lib/manual_slug/mongoid.rb
CHANGED
@@ -20,7 +20,13 @@ module ManualSlug::Mongoid
|
|
20
20
|
|
21
21
|
module ClassMethods
|
22
22
|
def manual_slug(field, options = {}, callback = true)
|
23
|
-
options.
|
23
|
+
unless options.key?(:permanent)
|
24
|
+
options[:permanent] = true
|
25
|
+
end
|
26
|
+
unless options.key?(:history)
|
27
|
+
options[:history] = true
|
28
|
+
end
|
29
|
+
|
24
30
|
slug field, options
|
25
31
|
|
26
32
|
# we will create slugs manually when needed
|
data/lib/manual_slug/version.rb
CHANGED