Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediavrog/a619df2945c11163112f to your computer and use it in GitHub Desktop.
Save mediavrog/a619df2945c11163112f to your computer and use it in GitHub Desktop.
JodaSupport ActiveRecord
val jodaDateTimeConverter = new FormConverter[DateTime] {
override def serialize(v: Any): String =
new DateTime(v).toString(ISODateTimeFormat.dateHourMinuteSecond)
override def deserialize(s: String): DateTime =
new DateTime(s.toLong)
}
FormConverter.register(classOf[DateTime], jodaDateTimeConverter)
ClassInfo.factories.register(classOf[DateTime], {() => DateTime.now.asInstanceOf[AnyRef]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment