2012-01-23 53 views
0

我有ActiveAdmin + Rails 3.1,一切正常 除了一件事我有一個嵌套的模型在我的產品。 一旦我添加了一個圖像,我不能從我的產品中刪除它! 我可以找到的唯一方法是在表格 內添加一個自定義鏈接到一個自定義操作,它將刪除此關聯。ActiveAdmin Formtasic DSL在嵌套集內添加一個鏈接

form do |f| 
    f.inputs "Options:" do 
     f.input:price 
     f.input:about 

     f.has_many :pictures do |son| 
#I NEED A LINK_TO REMOVE THIS ASSOCIATION INSIDE OF HERE 
     son.input :photo, :as => :file, :label => "pic",:hint => son.object.nil? ? son.template.content_tag(:span, "No Image Yet") : son.template.image_tag(son.object.photo.url(:thumb)) 
    end 

    f.buttons 
end 

但無法找到出路。似乎沒有這種方法來輸出自定義的HTML!

回答

0

用髒鉤解決:

:label =>(son.object.new_record? ? "Изображение" : son.template.link_to