mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
docs: update calculation example with better arg
This commit is contained in:
parent
2c8b07fd0b
commit
73c3b1a629
1 changed files with 7 additions and 3 deletions
|
@ -61,10 +61,14 @@ end
|
|||
# Usage in a resource
|
||||
calculations do
|
||||
calculate :full_name, :string, {Concat, keys: [:first_name, :last_name]} do
|
||||
# You currently need to use the [allow_empty?: true, trim?: false] constraints here.
|
||||
# You need to use the [allow_empty?: true, trim?: false] constraints here.
|
||||
# The separator could be an empty string or require a leading or trailing space,
|
||||
# but would be trimmed or even set to `nil` without the constraints.
|
||||
argument :separator, :string, constraints: [allow_empty?: true, trim?: false]
|
||||
# but would be trimmed or even set to `nil` without the constraints shown below.
|
||||
argument :separator, :string do
|
||||
allow_nil? false
|
||||
constraints [allow_empty?: true, trim?: false]
|
||||
default ""
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue