-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from dwyl/schema-underscore
Schema underscore
- Loading branch information
Showing
6 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
17 changes: 17 additions & 0 deletions
17
test/support/test_autoform/lib/test_autoform/DoWhatYouLove.ex
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule TestAutoform.DoWhatYouLove do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "do_what_you_love" do | ||
field(:name, :string) | ||
|
||
timestamps() | ||
end | ||
|
||
@doc false | ||
def changeset(user, attrs) do | ||
user | ||
|> cast(attrs, [:name]) | ||
|> validate_required([:name]) | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
test/support/test_autoform/lib/test_autoform_web/controllers/do_what_you_love_controller.ex
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
defmodule TestAutoformWeb.DoWhatYouLoveController do | ||
use TestAutoformWeb, :controller | ||
use Autoform | ||
|
||
alias TestAutoform.DoWhatYouLove | ||
|
||
def new(conn, _params) do | ||
changeset = DoWhatYouLove.changeset(%DoWhatYouLove{}, %{}) | ||
|
||
render_autoform(conn, :create, DoWhatYouLove, assigns: [changeset: changeset]) | ||
end | ||
|
||
end |
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