diff options
Diffstat (limited to 'app/app/db/core_ext.rb')
-rw-r--r-- | app/app/db/core_ext.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/app/db/core_ext.rb b/app/app/db/core_ext.rb new file mode 100644 index 0000000..81046a0 --- /dev/null +++ b/app/app/db/core_ext.rb @@ -0,0 +1,9 @@ +# Time extensions. +class Time + SQL_FORMAT = "TIMESTAMP '%Y-%m-%d %H:%M:%S'".freeze + + # Formats the Time object as an SQL TIMESTAMP. + def to_sql_timestamp + strftime(SQL_FORMAT) + end +end |