2010-08-27 35 views
1

我爲formtastic製作了一個自定義的輸入法,它被設計爲與carrierwave一起工作,並且效果很好,但有一個例外,預覽圖像和其他html不會呈現,因爲它正在被消毒(我認爲)。cutsom formtastic的輸入,我做錯了什麼?

我是否完全錯誤的方式?

下面是代碼:

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 

與呼喚:

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

描繪的圖像和
標籤時逃走了。

我該如何解決這個問題。

非常感謝

回答

0

這是在軌道3上嗎?如果是這樣,請嘗試調用「return c.html_safe」

+0

不幸的是不是rails 3,而是2.3.8 – nodrog 2010-08-29 19:04:34