File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,14 @@ create account hook:
26
26
enable :login, :logout, :create_account
27
27
28
28
before_create_account do
29
- name = param("name")
30
-
31
- # Validate the name field. This example checks that it is not empty,
32
- # but you may want to have application specific checks.
33
- if name.empty?
29
+ # Validate presence of the name field. This example checks that the was field was submitted
30
+ # and is not empty, but you may may want to have application specific checks.
31
+ if param("name").empty?
34
32
throw_error_status(422, "name", "must be present")
35
33
end
36
34
37
35
# Assign the new field to the account record
38
- account[:name] = name
36
+ account[:name] = param(" name")
39
37
end
40
38
end
41
39
@@ -55,7 +53,7 @@ You can then handle the new submitted field as follows:
55
53
enable :login, :logout, :create_account
56
54
57
55
before_create_account do
58
- # Validate the name field
56
+ # Validate presence of the name field
59
57
throw_error_status(422, "name", "must be present") if param("name").empty?
60
58
end
61
59
You can’t perform that action at this time.
0 commit comments