rails/activestorage/lib
Nate Matykiewicz dd894b2fc2
Allow an ActiveStorage attachment to be removed via a form post
Attachments can already be removed by updating the attachment to be nil such as:
```ruby
User.find(params[:id]).update!(avatar: nil)
```

However, a form cannot post a nil param, it can only post an empty string. But, posting an
empty string would result in an `ActiveSupport::MessageVerifier::InvalidSignature: mismatched digest`
error being raised, because it's being treated as a signed blob id.

Now, nil and an empty string are treated as a delete, which allows attachments to be removed via:
```ruby
User.find(params[:id]).update!(params.require(:user).permit(:avatar))

```
2023-05-29 22:58:25 -05:00
..
active_storage Allow an ActiveStorage attachment to be removed via a form post 2023-05-29 22:58:25 -05:00
tasks Invoke namespaced task when necessary 2021-05-26 13:44:42 +01:00
active_storage.rb Include READMEs in main framework pages of the API documentation 2023-03-21 21:16:28 +01:00