aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-09-17 14:20:54 +0200
committerGitHub <noreply@github.com>2017-09-17 14:20:54 +0200
commitfefc5e8e3757559cfbbb21390165c842bb8565f3 (patch)
treec1e253e450ab05731f8b7bfb4b46a4ef900a8731 /activestorage
parentc46c80b5298ff6d600597cb0edae88680f1fac7c (diff)
parent7d14bda3a7c74ec0262fa021e641a4235f5405d5 (diff)
downloadrails-fefc5e8e3757559cfbbb21390165c842bb8565f3.tar.gz
rails-fefc5e8e3757559cfbbb21390165c842bb8565f3.tar.bz2
rails-fefc5e8e3757559cfbbb21390165c842bb8565f3.zip
Merge pull request #30626 from yhirano55/fix_activestorage_readme
Fix file missing in activestorage's example code [ci skip]
Diffstat (limited to 'activestorage')
-rw-r--r--activestorage/README.md2
-rw-r--r--activestorage/lib/active_storage/attached/many.rb2
-rw-r--r--activestorage/lib/active_storage/attached/one.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/activestorage/README.md b/activestorage/README.md
index 17d98978bb..f4aae4fc00 100644
--- a/activestorage/README.md
+++ b/activestorage/README.md
@@ -24,7 +24,7 @@ class User < ApplicationRecord
end
# Attach an avatar to the user.
-user.avatar.attach(io: File.open("~/face.jpg"), filename: "avatar.jpg", content_type: "image/jpg")
+user.avatar.attach(io: File.open("/path/to/face.jpg"), filename: "face.jpg", content_type: "image/jpg")
# Does the user have an avatar?
user.avatar.attached? # => true
diff --git a/activestorage/lib/active_storage/attached/many.rb b/activestorage/lib/active_storage/attached/many.rb
index 59b7d7d559..1e0657c33c 100644
--- a/activestorage/lib/active_storage/attached/many.rb
+++ b/activestorage/lib/active_storage/attached/many.rb
@@ -17,7 +17,7 @@ module ActiveStorage
#
# document.images.attach(params[:images]) # Array of ActionDispatch::Http::UploadedFile objects
# document.images.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload
- # document.images.attach(io: File.open("~/racecar.jpg"), filename: "racecar.jpg", content_type: "image/jpg")
+ # document.images.attach(io: File.open("/path/to/racecar.jpg"), filename: "racecar.jpg", content_type: "image/jpg")
# document.images.attach([ first_blob, second_blob ])
def attach(*attachables)
attachables.flatten.collect do |attachable|
diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb
index ac90f32d95..c66be08f58 100644
--- a/activestorage/lib/active_storage/attached/one.rb
+++ b/activestorage/lib/active_storage/attached/one.rb
@@ -18,7 +18,7 @@ module ActiveStorage
#
# person.avatar.attach(params[:avatar]) # ActionDispatch::Http::UploadedFile object
# person.avatar.attach(params[:signed_blob_id]) # Signed reference to blob from direct upload
- # person.avatar.attach(io: File.open("~/face.jpg"), filename: "face.jpg", content_type: "image/jpg")
+ # person.avatar.attach(io: File.open("/path/to/face.jpg"), filename: "face.jpg", content_type: "image/jpg")
# person.avatar.attach(avatar_blob) # ActiveStorage::Blob object
def attach(attachable)
if attached? && dependent == :purge_later