I have a schedule model with Day and Time attributes. Time has a data type.
I have data, i.e.
Monday / 2014-04-26 15: 00: 00.000000Monday / 2014-04-25 16: 30: 00.000000
Monday / 2014-04-26 15: 00: 00.000000
Monday / 2014-04-25 16: 30: 00.000000
In my controller I have @schedule = Schedule.all(:order => 'Day, Time')
@schedule = Schedule.all(:order => 'Day, Time')
Now he is ordering by date, how do I order by time, regardless of the date?
This is a problem with the SQLite3 Ruby connector. Works great on Postgres.
It seems that SQLite does not have its own idea of the Time data type, as indicated here: Rails Active Record find (: all ,: order =>) issue and here: http://www.sqlite.org/datatype3.html
time i.e. class_time , : Sqlite3 activerecord: order = > " DESC"
time
class_time
Postgres,
@schedule = Schedule.all.order('date_time_field::time').
Mysql, , -
DATE_FORMAT(colName,'%H:%i:%s') TIMEONLY
Sqlite
@schedule = Schedule.all.order('time(date_time_field)')
Source: https://habr.com/ru/post/1538217/More articles:Smart pointer for single owner and multiple links - c ++Hive 0.13.0 - Where is the hive-hwi-.war file? - hivegulp dependent tasks - browser and task before the browser - javascriptAndroid diagonal triangular buttons - androidAndroid triangle custom buttons - androidNumPy: matrix by vector multiplication - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1538219/sbv-lib-seems-to-slow-for-sat-solving-how-to-use-picosatminisat&usg=ALkJrhj1RN17ZLGE-I_1IVaVi20Xto8h-wAngularJS: moving nested arrays - angularjsShowing control over other controls in a grid in WPF - layoutGit настройка, возврат терминала: команда не найдена - gitAll Articles