I don’t believe before_validation works like that. You probably want to write your method like this instead:
def strip_whitespace
self.name = self.name.strip unless self.name.nil?
self.email = self.email.strip unless self.email.nil?
self.nick = self.nick.strip unless self.nick.nil?
end
You could make it more dynamic if you want using something like self.columns, but that’s the gist of it.