Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Nested Forms Image Preview

Rubioli edited this page Mar 22, 2016 · 1 revision

In documentation hasn't been specified how to preview/show images after upload. The solution is very easy.

From the form helper object, you should be able to access the model object:

<%= image_tag f.object.image_url(:thumb) %>

NB:

  • :thumb is the style of the uploaded image. You can specify which style you would like to preview.
  • image_url depends on how you named the attribute. In some cases it can also be image like: f.object.image(:thumb)