sanitize-rails 0.6.0 → 0.6.1
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.
- data/lib/sanitize/rails.rb +5 -4
- metadata +2 -2
data/lib/sanitize/rails.rb
CHANGED
@@ -4,7 +4,7 @@ require 'sanitize'
|
|
4
4
|
require 'sanitize/railtie' if defined? Rails
|
5
5
|
|
6
6
|
module Sanitize::Rails
|
7
|
-
Version = '0.6.
|
7
|
+
Version = '0.6.1'
|
8
8
|
|
9
9
|
# Configures the sanitizer with the given `config` hash.
|
10
10
|
#
|
@@ -38,7 +38,7 @@ module Sanitize::Rails
|
|
38
38
|
# Returns a copy of the given `string` after sanitizing it
|
39
39
|
#
|
40
40
|
def clean(string)
|
41
|
-
clean!(
|
41
|
+
string.dup.tap {|s| clean!(s)}
|
42
42
|
end
|
43
43
|
|
44
44
|
# Sanitizes the given `string` in place
|
@@ -99,8 +99,9 @@ module Sanitize::Rails
|
|
99
99
|
|
100
100
|
define_method(sanitizer) do # # Unrolled version
|
101
101
|
fields.each do |field| #
|
102
|
-
|
103
|
-
|
102
|
+
value = send(field)
|
103
|
+
unless value.blank? # def sanitize_fieldA_fieldB
|
104
|
+
sanitized = Engine.clean(value) # self.fieldA = Engine.clean(self.fieldA) unless fieldA.blank?
|
104
105
|
send("#{field}=", sanitized) # self.fieldB = Engine.clean(self.fieldB) unless fieldB.blank?
|
105
106
|
end # end
|
106
107
|
end #
|