mirror of
https://github.com/affaan-m/ECC.git
synced 2026-12-01 12:45:15 +09:00
docs(rails-security): explain the direct-upload guard and name its auth
This commit is contained in:
1 parent
0edcf37ff5
commit
adfffc0ca8
1 file changed
+2
@@ -332,6 +332,8 @@ route; apps using direct uploads need a replacement route:
|
||||
|
||||
```ruby
|
||||
get "documents/:id/file", to: "document_files#show", as: :document_file
|
||||
# Rails' direct-upload endpoint has no authentication of its own. This example uses a
|
||||
# hand-rolled session sign-in; see Devise or the Rails 8 generator for their equivalents.
|
||||
constraints ->(req) { req.session[:user_id].present? } do
|
||||
post "uploads", to: "active_storage/direct_uploads#create", as: :rails_direct_uploads
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user