Skip to content

Instantly share code, notes, and snippets.

@danielfone
Last active July 14, 2021 00:16
Show Gist options
  • Select an option

  • Save danielfone/e87af1f369c6323dbe3cb20c97ffe7d3 to your computer and use it in GitHub Desktop.

Select an option

Save danielfone/e87af1f369c6323dbe3cb20c97ffe7d3 to your computer and use it in GitHub Desktop.

Revisions

  1. danielfone revised this gist Jul 14, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rails-reload-sql.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ In order to get Rails to reload when you change a sql file in development, you n
    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.
    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.**


    ```ruby
  2. danielfone created this gist Jul 14, 2021.
    14 changes: 14 additions & 0 deletions rails-reload-sql.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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.

    ```ruby
    # 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.


    ```ruby
    # DOES NOT WORK sad face
    config.watchable_dirs['app/queries'] = [:sql]
    ```