Skip to content

Instantly share code, notes, and snippets.

@johncarney
Last active December 20, 2017 04:36
Show Gist options
  • Save johncarney/f02cd9ce005b4b4b16ebeeb548c9924e to your computer and use it in GitHub Desktop.
Save johncarney/f02cd9ce005b4b4b16ebeeb548c9924e to your computer and use it in GitHub Desktop.

The arel_extensions gem has a couple of bugs...

  1. DateSub doesn't work:
(table[:column] - 10.hours).to_sql
# => NoMethodError: undefined method `to_sql' for nil:NilClass
  1. For MySQL, DateAdd generates a double-minus when given a negative duration:
(table[:column] + -10.hours).to_sql
# => DATE_ADD(`tmp_modules_fbt_travel_diaries`.`created_at`, INTERVAL --36000 second)

PR to fix this one: Faveod/arel-extensions#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment