Skip to content

Commit

Permalink
Merge pull request rails#42519 from ashiksp/update-storage-references
Browse files Browse the repository at this point in the history
[ci skip]Updated the has_many_attached references in the examples.
  • Loading branch information
zzak authored Jun 17, 2021
2 parents fe1cb68 + d4b2136 commit 0ea82ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions guides/source/active_storage_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,22 +486,22 @@ model test. To do that, provide a Hash containing at least an open IO object
and a filename:

```ruby
@message.image.attach(io: File.open('/path/to/file'), filename: 'file.pdf')
@message.images.attach(io: File.open('/path/to/file'), filename: 'file.pdf')
```

When possible, provide a content type as well. Active Storage attempts to
determine a file’s content type from its data. It falls back to the content
type you provide if it can’t do that.

```ruby
@message.image.attach(io: File.open('/path/to/file'), filename: 'file.pdf', content_type: 'application/pdf')
@message.images.attach(io: File.open('/path/to/file'), filename: 'file.pdf', content_type: 'application/pdf')
```

You can bypass the content type inference from the data by passing in
`identify: false` along with the `content_type`.

```ruby
@message.image.attach(
@message.images.attach(
io: File.open('/path/to/file'),
filename: 'file.pdf',
content_type: 'application/pdf',
Expand Down

0 comments on commit 0ea82ee

Please sign in to comment.