TIL, 2017-08-03
- Rails
find_by
works if finding by a model but I pass an ID in? - Non-breaking space.
select * from pg_timezone_names
.- ALIAS in a WHERE clause, not standard (works in MySQL but not in PostgreSQL?)
- Timezone 3 or 4 letter codes–these are different from place to place (EST or EDT), use the names (
America/New_York
). A time zone is more than an offset; a time zone includes the past, present, and future set of rules and anomalies such as DST. - Postgres Timestamps–if you want to qualify by date, you need to tell Postgres to treat the date field as a Timestamp first (
.where('pomodoros.created_at::timestamp WITH TIME ZONE AT TIME ZONE '#{Pomodoros::Constants::TIMEZONE_BASIS}'"
).