Skip to content

Instantly share code, notes, and snippets.

@cjbell
Created January 6, 2016 19:32
Show Gist options
  • Save cjbell/b32e00aee88f705b6187 to your computer and use it in GitHub Desktop.
Save cjbell/b32e00aee88f705b6187 to your computer and use it in GitHub Desktop.
defmodule MyApp.Web do
# ... Other lines removed for brevity
def controller do
quote do
use Phoenix.Controller
alias MyApp.Repo
import Ecto.Model
import Ecto.Query, only: [from: 2]
import MyApp.Router.Helpers
import MyApp.Controllers.Helpers
end
end
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment