How to access current module in Elixir

Patrick's answer is correct: you can use __MODULE__. However, I would advise all of your query functions in the model to receive the query as argument (see here: http://blog.drewolson.org/composable-queries-ecto/) and to not call the repository inside your model.

Leave the act of calling the repository, which is a side-effect, to the integration layer, like controllers and what not.


You can use __MODULE__, which will be replaced with the name of the enclosing module at compile time.