Created
June 5, 2015 03:53
-
-
Save chvanikoff/fd7cef3d5838f0546afc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline :my_pipeline do | |
plug :change_controller_method | |
end | |
def change_controller_method(conn) do | |
%{controller: controller, action: action} = get_controller(conn.params) | |
controller = "Elixir.Myapp.#{inspect controller}" |> String.to_atom() | |
conn | |
|> controller.call(controller.init(action)) | |
|> halt() | |
end | |
defp get_controller(params) do | |
# get controller based on some parmas values | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment