Ruby on rails 图像的简单形式的自定义输入
在我的表单中,我让用户上传一个文件(图像),它如下所示:Ruby on rails 图像的简单形式的自定义输入,ruby-on-rails,simple-form,Ruby On Rails,Simple Form,在我的表单中,我让用户上传一个文件(图像),它如下所示: = simple_form_for [:admin, @team] do |f| = f.input :logo, as: :photo = image_tag @team.logo.url if @team.logo? = f.hidden_field :logo_cache 现在我想为照片创建自定义输入,它应该包括隐藏字段和显示图像 class PhotoInput < SimpleForm::Inpu
= simple_form_for [:admin, @team] do |f|
= f.input :logo, as: :photo
= image_tag @team.logo.url if @team.logo?
= f.hidden_field :logo_cache
现在我想为照片创建自定义输入,它应该包括隐藏字段和显示图像
class PhotoInput < SimpleForm::Inputs::Base
def input
@builder.file_field(attribute_name, input_html_options).html_safe
end
end
class PhotoInput
这是我的基本知识,我有这个输入的问题,因为它似乎不知道方法图像标签,甚至链接到