Skip to content

Commit e8533e4

Browse files
authored
Update error_reporting.md
`User.find_by(params[:id])` will raise `ArgumentError` as it expects hash / keyword argument. I believe the point of this example was to show that `user` will be assigned to `User.anonymous` anytime User with id from `params[:id]` does not exist in the database.
1 parent a2f2dc8 commit e8533e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

guides/source/error_reporting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ If no error is raised in the block, `Rails.error.handle` will return the result
8888

8989
```ruby
9090
user = Rails.error.handle(fallback: -> { User.anonymous }) do
91-
User.find_by(params[:id])
91+
User.find(params[:id])
9292
end
9393
```
9494

0 commit comments

Comments
 (0)