Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #12
This one was kind of wild, and I may have gone a little overboard. Here's what the end result looks like:
This will display the request body exactly as it normally would, except for the uploaded file is replaced with a placeholder
<Lucky::UploadedFile
. I wanted this to look like it was an instance to sort of give you an idea of where to look for more docs when figuring out these uploaded files.Without this check, uploaded files that are plain text actually work fine provided they have utf8 safe chararset. When it comes to binary files like images, these will contain some invalid encoding characters so when you call
request.body.to_s
, it raises an error. Since we store the request body in to the database, we don't want to store the entire file. Instead, we're storing everything but the file, and just leaving a placeholder of what file you were uploading.