I have the following module
module SharedMethods
# Class method
module ClassMethods
#
# Remove white space from end of strings
def remove_whitespace
self.attributes.each do |key,value|
if value.kind_of?(String) && !value.blank?
write_attribute key, value.strip
end
end
end
end
#
#
def self.included(base)
base.extend(ClassMethods)
end
end
and I am using it in my models like
include SharedMethods
before_validation :remove_whitespace
However whenever I submit the form I get a "undefined method `remove_whitespace'" message
What can I do to correct this error?