aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_storage_overview.md
diff options
context:
space:
mode:
authorJeffrey Guenther <guenther.jeffrey@gmail.com>2017-11-21 10:27:02 -0800
committerJeffrey Guenther <guenther.jeffrey@gmail.com>2017-11-21 10:27:02 -0800
commit3afffebe215c54fff73d1023c7214c755f71ac6f (patch)
tree68528832785e717abb89a3ae82b9aa34fd58bc2f /guides/source/active_storage_overview.md
parent32203e889c771cbbc3f0bd9212d4b8bf4dc7da3f (diff)
downloadrails-3afffebe215c54fff73d1023c7214c755f71ac6f.tar.gz
rails-3afffebe215c54fff73d1023c7214c755f71ac6f.tar.bz2
rails-3afffebe215c54fff73d1023c7214c755f71ac6f.zip
Updates add multiple attachments example
Diffstat (limited to 'guides/source/active_storage_overview.md')
-rw-r--r--guides/source/active_storage_overview.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md
index e3f7861861..10ff3de453 100644
--- a/guides/source/active_storage_overview.md
+++ b/guides/source/active_storage_overview.md
@@ -214,14 +214,18 @@ class MessagesController < ApplicationController
end
def create
- message = Message.create! params.require(:message).permit(:title, :content)
- message.images.attach(params[:message][:images])
+ message = Message.create!(message_params)
redirect_to message
end
def show
@message = Message.find(params[:id])
end
+
+ private
+ def message_params
+ params.require(:message).permit(:title, :content, images: [])
+ end
end
```
@@ -254,7 +258,7 @@ url_for(user.avatar)
```
To create a download link, use the `rails_blob_{path|url}` helper. Using this
-helper will allow you to set disposition.
+helper allows you to set the disposition.
```ruby
rails_blob_path(user.avatar, disposition: "attachment")
@@ -263,7 +267,7 @@ rails_blob_path(user.avatar, disposition: "attachment")
Create Variations of Attached Image
-----------------------------------
-Sometimes your application will require images in a different format than
+Sometimes your application requires images in a different format than
what was uploaded. To create variation of the image, call `variant` on the Blob.
You can pass any [MiniMagick](https://github.com/minimagick/minimagick)
supported transformation.