Skip to content

Instantly share code, notes, and snippets.

@eezis
Last active August 29, 2015 14:12
Show Gist options
  • Save eezis/4cf8600086531157ce2d to your computer and use it in GitHub Desktop.
Save eezis/4cf8600086531157ce2d to your computer and use it in GitHub Desktop.
phoenix docs question
Are templates scoped to a controller by naming convention? And is that convention two layers deep
and implemented with filenames?
First convention describes rules for a controller's filename; stipulating that Controller filenames
get two parts seperated by
an underscore. An application with these three controllers -- PageController, HelloController, and
UserController -- should manifest the following file names:
controllers
|- page_controller.ex
|- hello_controller.ex
|- user_controller.ex
The second layer completes the association between the Controller and their respective file names by
stashing templates under a template subdirectory named after the first part of the controller name as
follows below:
templates
|- page
| index.html.eex
| file(1..n).html.eex
|- hello
| index.html.eex
| file(1..n).html.eex
|- user
| index.html.eex
| file(1..n).html.eex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment