What is the difference between f.template.image_tag and image_tag?

If you want to show a photo in your forms, the consensus says to do something like this:

ActiveAdmin.register Foobar do
  form :html => {:multipart => true} do |f|                                      
    f.input :thumbnail, :required => false, :as => :file,                      
            :hint => f.template.image_tag( f.object.thumbnail.url(:thumb) )       
    end                                                                          
    f.actions                                                                    
  end
end

      

When I did this, I got this:

#<#<Class:0x00000004950908>:0x0000000494d960>
<li class="file input optional" id="property_thumbnail_input"><label class="label" for="property_thumbnail">Thumbnail</label><input id="property_thumbnail" name="property[thumbnail]" type="file">

<p class="inline-hints"><img alt="431270" src="/system/properties/thumbnails/000/000/015/thumb/431270.png?1416340571"></p></li>

      

So I got the hex codes provided on my page: /

And it goes away if I just:

:hint => image_tag( f.object.thumbnail.url(:thumb) )

      

software versions:

formtastic (3.0.0)

paperclip (4.2.0)

+3


source to share


1 answer


f.template.image_tag and image_tag are the same, but the result of methods called on f.template goes differently than the result of calling image_tag. This behaves in the internals of ActiveAdmin, the reason is that ActiveAdmin keeps Arbre in the form after a while.



0


source







All Articles