ruby on rails 4 - activeadmin carrierwave image hint not displayed -


Hello I am using an active admin with the carrier gem. I am unable to see the preview on the image upload, my image SRC is always always empty. is empty

After clicking on Upload button, see the image related URL.

My form looks like this

  ActiveAdmin.register product permit_update: name, description, category_ id,: image form (: html = & gt; {: multipart = Gt; true}). F | F.inputs do "product" f.input: category_id ,: as = & gt; : Select, Archive = & gt; Category all f.input: Name f.input: Description f.input: image ,: as = & gt; : File,: signal = & gt; F.template.image_tag (f.object.image.url) end f.ctions end   

model

  class Product & lt; ActiveRecord :: Base is_to: Category mount_uploader: Image, Image Uploader Termination   

Serializer

  Class ProductSerializer & lt; ActiveModel :: Serializer Features: ID, name, description, image end   

My uploader looks like this

  class ImageUploader & lt; CarrierWave :: Uploader :: Base Storage: file def store_dir "upload / # {model.class.to_s.underscore}" / # {mounted_as} / # {model.id} "End End   

Creating HTML

  & lt; Label = "product_image"> for "label" gt; Image & lt; / Label & gt; & Lt; Input id = "product_image" name = "product [image]" type = "file" & gt; & Lt; P class = "inline-sign" & gt; & Lt; Img src = "" & gt; & Lt; / P & gt;    

After some modifications, works fine for me: < Pre> ActiveAdmin.register Team What permit_params: Name, Country: Image Index selection enable_column Columns: Nom column: Country Action End Form | F | F.inputs "team" f.input: nome f.input: country f.input: image ,: image_preview = & gt; True end f.actions end show attributes_table do row: nome row: country line: image image_tag (equipe.image.url) end and end

You can see that I have three options: - Index: To show list of items - Form: For Form - Show: To show item details

In this way you can customize all the pages.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -