summaryrefslogtreecommitdiff
path: root/app/models/concerns/strip_attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/strip_attribute.rb')
-rw-r--r--app/models/concerns/strip_attribute.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/concerns/strip_attribute.rb b/app/models/concerns/strip_attribute.rb
index 8f6a6244dd3..1c433a3275e 100644
--- a/app/models/concerns/strip_attribute.rb
+++ b/app/models/concerns/strip_attribute.rb
@@ -7,7 +7,7 @@
# Usage:
#
# class Milestone < ApplicationRecord
-# strip_attributes :title
+# strip_attributes! :title
# end
#
#
@@ -15,7 +15,7 @@ module StripAttribute
extend ActiveSupport::Concern
class_methods do
- def strip_attributes(*attrs)
+ def strip_attributes!(*attrs)
strip_attrs.concat(attrs)
end
@@ -25,10 +25,10 @@ module StripAttribute
end
included do
- before_validation :strip_attributes
+ before_validation :strip_attributes!
end
- def strip_attributes
+ def strip_attributes!
self.class.strip_attrs.each do |attr|
self[attr].strip! if self[attr] && self[attr].respond_to?(:strip!)
end