Skip to content

Instantly share code, notes, and snippets.

@danielfone
Last active July 14, 2021 00:16
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 danielfone/e87af1f369c6323dbe3cb20c97ffe7d3 to your computer and use it in GitHub Desktop.
Save danielfone/e87af1f369c6323dbe3cb20c97ffe7d3 to your computer and use it in GitHub Desktop.

In order to get Rails to reload when you change a sql file in development, you need to add the query directory to the watchable_dirs hash.

# watchable_dirs is keyed by path with an array of extensions as the value
config.watchable_dirs['db/queries'] = [:sql]

Rails automatically adds the autoload paths to watchable dirs with an extension of [:rb]. This includes all the directories in app/. This will override any matching paths you add to watchable_dirs.

# DOES NOT WORK sad face
config.watchable_dirs['app/queries'] = [:sql]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment