| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
cbothner/fail-gracefully-from-activestorage-file-not-found
Fail more gracefully from ActiveStorage missing file exceptions
|
| |
| |
| |
| |
| |
| | |
`ActiveStorage::DiskController#show` generates a 404 Not Found response when
the requested file is missing from the disk service. It previously raised
`Errno::ENOENT`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`ActiveStorage::Blob#download` and `ActiveStorage::Blob#open` raise
`ActiveStorage::FileNotFoundError` when the corresponding file is missing
from the storage service. Services translate service-specific missing
object exceptions (e.g. `Google::Cloud::NotFoundError` for the GCS service
and `Errno::ENOENT` for the disk service) into
`ActiveStorage::FileNotFoundError`.
|
|/
|
|
| |
This test no longer covers the behavior of ActiveStorage::PurgeJob. Attached blobs are ignored by ActiveStorage::Blob#purge as of 934fccd, which includes an equivalent model test.
|
| |
|
|
|
|
| |
Closes #32530.
|
|
|
| |
Do nothing instead of raising an error when it’s called on an attached blob.
|
|\
| |
| |
| |
| | |
albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.
We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
overwrite previous attachments
|
| | |
|
| | |
|
| |
| |
| |
| | |
Closes #32193.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider the following model definitions:
class User < ApplicationRecord
has_one_attached :avatar
end
class Group < ApplicationRecord
has_one_attached :avatar
end
If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
|
|
|
|
| |
Sidestep Google Cloud Storage's restrictive per-object rate limit.
|
| |
|
|
|
|
| |
Ref: https://github.com/ruby/ruby/blob/cc77a811298bd7ab1c422f7f999b93c858327da9/lib/net/http/response.rb#L138-L155
|
|
|
|
|
|
|
|
|
|
|
| |
Don't include `ActiveJob::TestHelper` since there is no test that uses it.
Ensure removing of overridden User's methods.
Related to https://github.com/rails/rails/pull/33085#issuecomment-395548563
Module#remove_method is private in Ruby 2.4.
Related to fd0bd1bf682622f064ac437ceee4e1b2a6b6d3b9
|
|\
| |
| | |
ActiveStorage reflection
|
| | |
|
| |
| |
| |
| | |
Add the ability to reflect on the attachments that have been defined using ActiveRecord::Reflection.
|
| | |
|
|/ |
|
| |
|
| |
|
|\
| |
| | |
Add ActiveStorage::Service::DiskService#url_for_direct_upload test
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In response to https://github.com/rails/rails/issues/32917
In the current implementation, ActiveStorage passes all options to the underlying processor,
including when a key has a value of false.
For example, passing:
```
avatar.variant(resize: "100x100", monochrome: false, flip: "-90")
```
will return a monochrome image (or an error, pending on ImageMagick configuration) because
it passes `-monochrome false` to the command (but the command line does not allow disabling
flags this way, as usually a user would omit the flag entirely to disable that feature).
This fix only passes those keys forward to the underlying processor if the value responds to
`present?`. In practice, this means that `false` or `nil` will be filtered out before going
to the processor.
One possible use case would be for a user to be able to apply different filters to an avatar.
The code might look something like:
```
variant_options = {
monochrome: params[:monochrome],
resize: params[:resize]
}
avatar.variant(*variant_options)
```
Obviously some sanitization may be beneficial in a real-world scenario, but this type of
configuration object could be used in many other places as well.
- Add removing falsy values from varaints to changelog
- The entirety of #image_processing_transformation inject block was wrapped in `list.tap`
to guard against the default `nil` being returned if no conditional was called.
- add test for explicitly true variant options
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Generated attachment getter and setter methods are created within
the model's `GeneratedAssociationMethods` module to allow overriding
and composition using `super`.
Includes tests for new functionality.
Co-authored-by: Josh Susser <josh@hasmanythrough.com>
Co-authored-by: Jamon Douglas <terrildouglas@gmail.com>
|
| |
| |
| |
| | |
[David Robertson & George Claghorn]
|
| |
| |
| |
| |
| |
| |
| | |
This adds a boolean argument called identify to ActiveStorage::Blob
methods #create_after_upload, #build_after_upload and #upload. It
allows a user to bypass the automatic content_type inference from
the io.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Match other services, which all use a 5 MB chunk size.
|
|\ \
| | |
| | | |
has_(one/many)_attached presence validation
|
| | | |
|