问题
When I use formtastic DSL for ActiveAdmin edit form I get the following output:
#< #< 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" />
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
回答1:
This should work:
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
回答2:
Try it.
form :html => { :multipart => true } do |f|
f.inputs do
#...
f.input :image, required: false, :hint => image_tag(f.object.image.url(:medium))
#...
end
f.actions
end
来源:https://stackoverflow.com/questions/27667966/formtastic-hint-issue-unwanted-object-id-output-in-activeadmin