aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins')
-rw-r--r--vendor/plugins/strip_attributes/lib/strip_attributes.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/vendor/plugins/strip_attributes/lib/strip_attributes.rb b/vendor/plugins/strip_attributes/lib/strip_attributes.rb
index bb93aa9a7..130d10185 100644
--- a/vendor/plugins/strip_attributes/lib/strip_attributes.rb
+++ b/vendor/plugins/strip_attributes/lib/strip_attributes.rb
@@ -8,12 +8,15 @@ module StripAttributes
attribute_names.each do |attribute_name|
value = record[attribute_name]
if value.respond_to?(:strip)
- record[attribute_name] = (value.nil?) ? nil : value.strip
+ stripped = value.strip
+ if stripped != value
+ record[attribute_name] = (value.nil?) ? nil : stripped
+ end
end
end
end
end
-
+
# Necessary because Rails has removed the narrowing of attributes using :only
# and :except on Base#attributes
def self.narrow(attribute_names, options)
@@ -28,7 +31,7 @@ module StripAttributes
attribute_names & only
else
raise ArgumentError, "Options does not specify :except or :only (#{options.keys.inspect})"
- end
+ end
end
end
end