diff options
author | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-17 10:06:47 +0900 |
---|---|---|
committer | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-17 21:00:23 +0900 |
commit | 7d14bda3a7c74ec0262fa021e641a4235f5405d5 (patch) | |
tree | f81a86e9e66a51ab41fd53d71daca443a31c4de1 /activestorage/lib/active_storage/attached | |
parent | bf206dc2fc66f844c561329ca2fd9c0418d3ff90 (diff) | |
download | rails-7d14bda3a7c74ec0262fa021e641a4235f5405d5.tar.gz rails-7d14bda3a7c74ec0262fa021e641a4235f5405d5.tar.bz2 rails-7d14bda3a7c74ec0262fa021e641a4235f5405d5.zip |
Fix file missing in activestorage's example code [ci skip]
* File.open("~/face.jpg") raise error:
`Errno::ENOENT: No such file or directory @ rb_sysopen - ~/face.jpg`
Diffstat (limited to 'activestorage/lib/active_storage/attached')
-rw-r--r-- | activestorage/lib/active_storage/attached/many.rb | 2 | ||||
-rw-r--r-- | activestorage/lib/active_storage/attached/one.rb | 2 |
2 files changed, 2 insertions, 2 deletions
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 |