mm-sanitize 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/mm-sanitize.rb +2 -4
- metadata +3 -3
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
# Change these as appropriate
|
23
23
|
s.name = "mm-sanitize"
|
24
|
-
s.version = "0.1.
|
24
|
+
s.version = "0.1.2"
|
25
25
|
s.summary = "Tiny plugin for MongoMapper to sanitize strings before validation."
|
26
26
|
s.author = "Richard Livsey"
|
27
27
|
s.email = "youremail@example.com"
|
data/lib/mm-sanitize.rb
CHANGED
@@ -8,10 +8,6 @@ module MongoMapper
|
|
8
8
|
model.plugin self
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.configure(base)
|
12
|
-
base.before_validation :sanitize_attributes
|
13
|
-
end
|
14
|
-
|
15
11
|
module ClassMethods
|
16
12
|
def sanitize(*keys)
|
17
13
|
options = keys.pop if keys.last.is_a?(Hash)
|
@@ -21,6 +17,8 @@ module MongoMapper
|
|
21
17
|
keys.each do |key|
|
22
18
|
@sanitize_keys[key] = options[:config]
|
23
19
|
end
|
20
|
+
|
21
|
+
self.send(:before_validation, :sanitize_attributes)
|
24
22
|
end
|
25
23
|
|
26
24
|
class_eval do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-sanitize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Livsey
|