Skip to content

Instantly share code, notes, and snippets.

@sigra
Created September 29, 2015 10:34
Show Gist options
  • Save sigra/2f42d73878a04ed6cf71 to your computer and use it in GitHub Desktop.
Save sigra/2f42d73878a04ed6cf71 to your computer and use it in GitHub Desktop.
def clean_whitespaces
%i(tag router_id mac_address access_code).each do |field|
unless self.send(field).nil?
self.send("#{field}=", self.send(field).squish.strip)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment