You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-5
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,6 @@ You make your model JSON-encodable using Poison. You should also use `Ecto.UUID`
22
22
The Crudex.Model also provides the following macros:
23
23
24
24
*`crudex_schema` => is like `schema` from Ecto.Model but defines ID/foreign keys to be UUID and creates timestamps. You should use this if you want to use the CRUD controller functionalities. It also allows using the two macros below
25
-
*`virtual_field` => creates a virtual field, which value will be resolved during encoding, by invoking a callback.
26
25
*`hidden_field` => creates a regular field which will be excluded when encoding
27
26
28
27
### Example
@@ -33,15 +32,12 @@ defmodule Example.User do
33
32
crudex_schema "users"do
34
33
field :name, :string
35
34
field :surname, :string
36
-
virtual_field :full_name, :string
37
35
field :email, :string
38
36
hidden_field :salt, Crudex.JSONBinary
39
37
hidden_field :password, Crudex.JSONBinary
40
38
field :role, :string
41
39
end
42
-
43
-
def__crudex_virtuals__(:resolve, :full_name, %{name: name, surname: surname}), do: name <>""<> surname
0 commit comments