Skip to content

Commit d44ae3c

Browse files
committed
Conclude registration field guide fix (#472)
1 parent abfe018 commit d44ae3c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

doc/guides/registration_field.rdoc

+5-7
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ create account hook:
2626
enable :login, :logout, :create_account
2727

2828
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?
3432
throw_error_status(422, "name", "must be present")
3533
end
3634

3735
# Assign the new field to the account record
38-
account[:name] = name
36+
account[:name] = param("name")
3937
end
4038
end
4139

@@ -55,7 +53,7 @@ You can then handle the new submitted field as follows:
5553
enable :login, :logout, :create_account
5654

5755
before_create_account do
58-
# Validate the name field
56+
# Validate presence of the name field
5957
throw_error_status(422, "name", "must be present") if param("name").empty?
6058
end
6159

0 commit comments

Comments
 (0)