Sebastien Sebastien - 1 year ago 131
Ruby Question

Image file input with Formtastic and ActiveAdmin

I started to use formstatic but I need to make a file field with image preview. I mean, when i edit an object, i want to see the image already linked.

How can I do that?

Thank you !

Answer Source

The answer is to use the hint attribute :

ActiveAdmin.register Event do
  form :html => { :enctype => "multipart/form-data" } do |f|
    f.input :map, :as => :file, :hint => f.template.image_tag(


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download