views:

29

answers:

1

Hi

I have made a custom input method for formtastic, it is designed to work with carrierwave and it works great but with one exception, the preview image and other html will not render, as it is being sanitized (i think).

Am i going about this completely the wrong way?

Here is the code:

def carrierwave_input(method, options)
   c = basic_input_helper(:file_field, :string, method, options) 

   c += hidden_input((method.to_s+"_cache").to_sym, {})


   if object.send("#{method.to_s}?")
     c += %{<img src="#{object.send("#{method.to_s}_url")}">}
     c += "<br>"
     c += boolean_input(("remove_"+method.to_s).to_sym, {})
   end

return c

end

calling with:

form.input :thumb, :as => :carrierwave

when rendered the image and
tags escaped.

how can i get round this.

many thanks

A: 

Is this on rails 3? If so, try calling "return c.html_safe"

James Healy
unfortunatly not rails 3, but 2.3.8
nodrog