ActiveAdmin中的严重提示问题(不需要的对象ID输出) [英] Formtastic hint issue (unwanted object ID output) in ActiveAdmin
问题描述
当我使用表格DSL进行ActiveAdmin编辑时,会得到以下输出:
When I use formtastic DSL for ActiveAdmin edit form I get the following output:
#< #< Class:0x00000006bd1f68>:0x00000006bd1018>< li
class =可选的文件输入;
id = post_image_input> label class = label
for = post_image>图像// label<输入
id = post_image name = post [image]
type =文件 />
#< #< Class:0x00000006bd1f68>:0x00000006bd1018> <li class="file input optional" id="post_image_input"><label class="label" for="post_image">Image</label><input id="post_image" name="post[image]" type="file" />
为什么从obj.inspect之类的结果开始,以及如何删除此部分?
Why does this starts from something like result of obj.inspect and how to remove this part?
导致此错误的代码在这里:
The code, causing this bug is here:
form :html => { :multipart => true } do |f|
f.inputs do
#...
f.input :image, required: false, hint: f.template.image_tag(f.object.image.url(:medium)).html_safe
#...
end
f.actions
end
推荐答案
这应该有效:
form :html => { :multipart => true } do |f|
f.inputs do
#...
f.input :image, required: false, hint: image_tag(object.image.url(:medium)).html_safe
#...
end
f.actions
end
这篇关于ActiveAdmin中的严重提示问题(不需要的对象ID输出)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!