ruby on rails - custom inputs of simple form for images -


in form, let user upload file (image), looks this:

= simple_form_for [:admin, @team] |f|     = f.input :logo, as: :photo     = image_tag @team.logo.url if @team.logo?     = f.hidden_field :logo_cache 

and want create custom input photos, should include hidden field , displaying image.

class photoinput < simpleform::inputs::base   def input     @builder.file_field(attribute_name, input_html_options).html_safe   end end 

this basics, have problems input, because doesnt seem know methods image_tag or link_to...


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -