mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-19 23:02:48 +12:00
Improve form documentation (#97)
This commit is contained in:
parent
5fd089afad
commit
900c5916a2
1 changed files with 9 additions and 7 deletions
|
@ -242,26 +242,28 @@ defmodule AshPhoenix.Form do
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
prepare_source: [
|
prepare_source: [
|
||||||
type: :any,
|
type: {:or, [{:fun, 1}, {:in, [nil]}]},
|
||||||
doc: """
|
doc: """
|
||||||
Takes a function over a changeset and runs it before calling the relevant changeset function. This can be used to do things like:
|
A 1-argument function the receives the initial changeset (or query) and makes any relevant changes to it.
|
||||||
|
This can be used to do things like:
|
||||||
|
|
||||||
* set private argument values before the validations are run using `Ash.Changeset.set_arguments/2` or `Ash.Changeset.set_argument/3`
|
* Set default argument values before the validations are run using `Ash.Changeset.set_arguments/2` or `Ash.Changeset.set_argument/3`
|
||||||
* set changeset context
|
* Set changeset context
|
||||||
* do any other pre-processing on the changeset
|
* Do any other pre-processing on the changeset
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
prepare_params: [
|
prepare_params: [
|
||||||
type: {:or, [{:fun, 2}, {:in, [nil]}]},
|
type: {:or, [{:fun, 2}, {:in, [nil]}]},
|
||||||
doc: """
|
doc: """
|
||||||
A function for pre-processing the form parameters before they are handled by the form.
|
A 2-argument function that receives the params map and the :validate atom and should return prepared params.
|
||||||
|
Called before the form is validated.
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
transform_params: [
|
transform_params: [
|
||||||
type: {:or, [{:fun, 2}, {:fun, 3}, {:in, [nil]}]},
|
type: {:or, [{:fun, 2}, {:fun, 3}, {:in, [nil]}]},
|
||||||
doc: """
|
doc: """
|
||||||
A function for post-processing the form parameters before they are used for changeset validation/submission.
|
A function for post-processing the form parameters before they are used for changeset validation/submission.
|
||||||
Use a 3 argument function to pattern match on the `AshPhoenix.Form` struct.
|
Use a 3-argument function to pattern match on the `AshPhoenix.Form` struct.
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
method: [
|
method: [
|
||||||
|
|
Loading…
Reference in a new issue