Skip to content
This repository was archived by the owner on Sep 5, 2018. It is now read-only.
Prev Previous commit
Updating cast arity
  • Loading branch information
Jason Stiebs committed May 17, 2016
commit 23f30e4776b826625fe5989aaa1950ee07b3bd8b
2 changes: 1 addition & 1 deletion H_ecto_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def changeset(model, params \\ :empty) do
end
```

At this point, we only have one transformation in our pipeline. This `cast/4` function's main job is to separate required fields from optional ones. We define the fields for each category in the module attributes `@required_fields` and `@optional_fields`. By default all of the fields are required.
At this point, we only have one transformation in our pipeline. This `cast/3` function's main job is to separate required fields from optional ones. We define the fields for each category in the module attributes `@required_fields` and `@optional_fields`. By default all of the fields are required.

Let's take a look at two ways to validate that this is the case. The first and easiest way is to simply start our application by running the `mix phoenix.server` task at the root of our project. Then we can go to the [new users page](http://localhost:4000/users/new) and click the "submit" button without filling in any fields. We should get an error telling us that something went wrong and enumerating all the fields which can't be blank. That should be all the fields in our schema at this point.

Expand Down