Skip to content

Add attachment and attachments field generators#35805

Merged
rafaelfranca merged 1 commit intorails:masterfrom
excid3:attachments-field-generators
Apr 2, 2019
Merged

Add attachment and attachments field generators#35805
rafaelfranca merged 1 commit intorails:masterfrom
excid3:attachments-field-generators

Conversation

@excid3
Copy link
Contributor

@excid3 excid3 commented Mar 30, 2019

Adds two new field generators for models attachment and attachments which will generate has_one_attached and has_many_attached in models.

It also generates file fields for each, adding multiple: true to has_many_attached, and renders links to the files on the show action.

Hopefully this makes it a lot easier for people to get started using ActiveStorage and ActionText. 👍

This is similar to the addition of the rich_text field generators added in #35781.

@rafaelfranca rafaelfranca merged commit 6c6c579 into rails:master Apr 2, 2019
y-yagi added a commit to y-yagi/jbuilder that referenced this pull request Apr 4, 2019
The params generation was cut out to a method in rails/rails#35805.
This is to handle the attachments field.

So use the method in jbuilder as well. Without this, a permit to handle
arrays is not generated if attachments field is specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants