mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Merge pull request #1697 from enriquez/fix-activestorage-manu
Fix for ActiveStorage::Attached::Many
This commit is contained in:
commit
7d016d8cc5
3 changed files with 10 additions and 0 deletions
|
@ -591,6 +591,7 @@ module SimpleForm
|
|||
# Returns a Boolean.
|
||||
def file_method?(attribute_name)
|
||||
@object.respond_to?("#{attribute_name}_attachment") ||
|
||||
@object.respond_to?("#{attribute_name}_attachments") ||
|
||||
@object.respond_to?("remote_#{attribute_name}_url") ||
|
||||
@object.respond_to?("#{attribute_name}_attacher") ||
|
||||
@object.respond_to?("#{attribute_name}_file_name")
|
||||
|
|
|
@ -244,6 +244,11 @@ class FormBuilderTest < ActionView::TestCase
|
|||
assert_select 'form input#user_with_attachment_avatar.file'
|
||||
end
|
||||
|
||||
test 'builder generates file input for ActiveStorage::Attached::Many' do
|
||||
with_form_for UserWithAttachment.build, :avatars
|
||||
assert_select 'form input#user_with_attachment_avatars.file'
|
||||
end
|
||||
|
||||
test 'builder generates file input for Refile >= 0.3.0 and CarrierWave >= 0.2.2' do
|
||||
with_form_for UserWithAttachment.build, :cover
|
||||
assert_select 'form input#user_with_attachment_cover.file'
|
||||
|
|
|
@ -339,6 +339,10 @@ class UserWithAttachment < User
|
|||
OpenStruct.new
|
||||
end
|
||||
|
||||
def avatars_attachments
|
||||
OpenStruct.new
|
||||
end
|
||||
|
||||
def remote_cover_url
|
||||
"/uploads/cover.png"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue