Skip to content

Instantly share code, notes, and snippets.

@rafarubert
Created January 22, 2011 04:42
Show Gist options
  • Save rafarubert/790860 to your computer and use it in GitHub Desktop.
Save rafarubert/790860 to your computer and use it in GitHub Desktop.
def date=(date)
write_attribute(:date, date.gsub(/(\d{4})\/(\d{2})\/(\d{2})/, "#{$3}/#{$2}/#{$1}"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment