zhaorong-mm-sluggable 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/mm-sluggable.rb +1 -2
- metadata +1 -1
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
# Change these as appropriate
|
17
17
|
s.name = "zhaorong-mm-sluggable"
|
18
|
-
s.version = "0.0.
|
18
|
+
s.version = "0.0.3"
|
19
19
|
s.summary = "Tiny plugin for MongoMapper to cache a slugged version of a field"
|
20
20
|
s.author = "Richard Livsey"
|
21
21
|
s.email = "richard@livsey.org"
|
data/lib/mm-sluggable.rb
CHANGED
@@ -6,14 +6,13 @@ module MongoMapper
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
module ClassMethods
|
9
|
-
alias_method :origin_find, :find
|
10
9
|
def find(*args)
|
11
10
|
arg_f = args.first
|
12
11
|
if (args.size == 1) && arg_f.is_a?(String) && ( arg_f !~ /^[0-9a-f]{24}$/i )
|
13
12
|
options = slug_options
|
14
13
|
first options[:key] => arg_f
|
15
14
|
else
|
16
|
-
|
15
|
+
super *args
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|