aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/models
Commit message (Collapse)AuthorAgeFilesLines
* Use a current model to provide the host for service urlsAndrew White2018-04-061-1/+1
| | | | | | | Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service).
* Flip the order of the after_create callbacksDwight Watson2018-03-271-3/+13
| | | | | | | | | | Addresses rails/rails#32247 Add test that checks identify and analyze work in correct order Break out direct upload test helper Review changes for direct-upload test helper
* Allow selectively purging attached blobsNicholas Shirley2018-03-061-0/+28
|
* Fix purging dependent blobs when attachments aren't loadedGeorge Claghorn2018-03-051-2/+16
|
* Delete dependent attachments with recordGeorge Claghorn2018-03-051-0/+14
| | | | [Matt Jones & George Claghorn]
* Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-052-2/+1
| | | | Fixes #32129.
* Handle another case where a blob might be erroneously purgedGeorge Claghorn2018-03-041-0/+12
|
* Avoid purging attached blob when replacing it with itselfGeorge Claghorn2018-03-041-0/+12
|
* Support varying ICO filesGeorge Claghorn2018-02-241-0/+11
| | | | Closes #32096.
* Add ActiveStorage::Blob.unattached scopefatkodima2018-02-121-0/+17
|
* Fix `blob.service_url` for supports string or nil `:filename` option.Jason Lee2018-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - Make sure `blob.service_url` present a `ActiveStorage::Filename` type to `serivce.url`. - Add `ActiveStorage::Filename.wrap` method. before: ```rb blob.service_url(filename: ActiveStorage::Filename.new("new.txt")) blob.service_url(filename: "new.txt") => NoMethodError: undefined method `parameters' for "new.txt":String params = {} blob.service_url(filename: params[:filename]) => NoMethodError: undefined method `parameters' for nil:NilClass ``` after: ```rb blob.service_url(filename: "new.txt") blob.service_url(filename: nil) ```
* Allow `ActiveStorage::Blob#service_url` to pass addition options to ↵Jason Lee2018-02-011-0/+20
| | | | | | | | | | | | | | | | | | | | | | | `service.url`. Because there have some service needs more parameters for file URL: https://www.alibabacloud.com/help/doc-detail/44687.htm ```rb class AliyunService < Service def url(key, options = {}) image_process = options[:oss_process] || "image/resize,w_800" "http://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=#{image_process}" end end ``` Use case: ```erb <%= image_tag @user.avatar.service_url(oss_process: "image/resize,m_fill,h_100,w_100" %> ```
* Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?Shuhei Kitagawa2018-01-291-0/+12
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-253-21/+21
|
* Extract content types from blob dataGeorge Claghorn2018-01-153-3/+36
|
* Extract Analyzable and Representable concernsGeorge Claghorn2018-01-103-3/+3
|
* Allow overriding filename in `Blob#service_url`Rosa Gutierrez2018-01-081-3/+14
| | | | | | | This is useful when we have several representations for the same underlying file, each one with a different name, and we need to provide a custom download URL based on that name and not that of the underlying file.
* Force content disposition to attachment for specific content typesRosa Gutierrez2018-01-051-0/+9
| | | | | | | | | | | | | | In this way we avoid HTML, XML, SVG and other files that can be rendered by the browser to be served inline by default. Depending on the origin from where these files are served, this might lead to XSS vulnerabilities, and in the best case, to more realistic phishing attacks and open redirects. We force it rather than falling back to it when other disposition is not provided. Otherwise it would be possible for someone to force inline just by passing `disposition=inline` in the URL. The list of content types to be served as attachments is configurable.
* Restore support for the -layers transformationGeorge Claghorn2018-01-021-0/+8
|
* Add support for combined MiniMagick transformationsRobert Glaser2017-12-221-0/+14
|
* Convert non-web image (e.g. PSD) variants to PNGGeorge Claghorn2017-12-181-9/+19
|
* Restrict variants to variable image blobsGeorge Claghorn2017-12-151-0/+6
|
* Purge variants with their blobsGeorge Claghorn2017-12-021-1/+9
|
* Provide attachment writersGeorge Claghorn2017-11-201-0/+32
| | | | | | | | | | | | | Permit creating a record and attaching files in a single step. # Before: User.create!(user_params.except(:avatar)).tap do |user| user.avatar.attach(user_params[:avatar]) end # After: User.create!(user_params) [Yoshiyuki Hirano & George Claghorn]
* Permit attaching files to new recordsGeorge Claghorn2017-11-191-0/+44
| | | | Closes #31164.
* Fix ASt CI failure with rack-test 0.7.1Ryuta Kamizono2017-11-201-1/+1
| | | | Due to https://github.com/rack-test/rack-test/commit/5fd3631078e7c73aaed7d4371f70fb2a79384be9.
* Introduce ActiveStorage::Attached::{One,Many}#detachGeorge Claghorn2017-11-141-0/+26
|
* Preserve existing metadata when analyzing a blobGeorge Claghorn2017-11-131-0/+25
| | | | Closes #31138.
* Extract metadata from images and videosGeorge Claghorn2017-10-221-1/+58
|
* Introduce ActiveStorage::Blob#representationGeorge Claghorn2017-10-122-0/+43
|
* Replace variation key use with SHA256 of key to prevent long filenameskhall2017-10-051-0/+5
| | | | | | | If a variant has a large set of options associated with it, the generated filename will be too long, causing Errno::ENAMETOOLONG to be raised. This change replaces those potentially long filenames with a much more compact SHA256 hash. Fixes #30662.
* Preview PDFs and videosGeorge Claghorn2017-09-282-3/+41
|
* Add `with_attached_*` scope to `has_one_attached` macroYoshiyuki Hirano2017-09-191-0/+13
| | | | | * For avoiding N+1 problem, added `with_attached_*` scope to `has_one_attached` macro.
* Fix replacing a singular attachmentGeorge Claghorn2017-08-291-0/+25
|
* Encode Content-Disposition filenames according to RFC 2231George Claghorn2017-08-212-1/+33
| | | | Closes #30134.
* DRYGeorge Claghorn2017-08-201-1/+1
|
* Rename ActiveStorage::Filename#extname to extension_with_delimiterGeorge Claghorn2017-08-201-0/+18
|
* Add missing test for Blob#purgeJon Moss2017-08-171-0/+7
|
* Move test to its proper placeGeorge Claghorn2017-08-141-0/+38
| | | | ActiveStorage::Filename is a model, so its test case belongs in test/models.
* Should escape regexp wildcard character `.`Koichi ITO2017-08-141-2/+2
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-123-0/+6
|
* Make activestorage treat Rack::Test::UploadedFile just like ↵Isaac Betesh2017-08-111-1/+7
| | | | ActionDispatch::Http::UploadedFile
* Run Active Storage tests in CI (#30144)George Claghorn2017-08-101-7/+0
|
* Fix ruby warningsyuuji.yaginuma2017-08-051-3/+3
| | | | | | | | | | This fixes following warnings: ``` test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized ```
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-313-0/+198
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58