Last active
May 4, 2016 20:36
-
-
Save ctrlShiftBryan/97632723db34d73bfab570d6a1e2da1c to your computer and use it in GitHub Desktop.
Struct As Params?
This file contains hidden or 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
| defmodule Foo.BarController do | |
| use Foo.Web, :controller | |
| defmodule ByKeyParams do | |
| defstruct dob: "", last_name: "", request_id: "" | |
| end | |
| def by_key(conn, params) do | |
| params = %ByKeyParams{} |> map.merge(params) | |
| request = %Foo.Request{} | |
| conn | |
| |> render("request.json", request: request) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment