2013-07-11 50 views
1

我有這個代碼裏面的應用程序/管理/ products.rb。我有問題,我可以看到只有一個輸入字段(最後一個列出)或只是提交按鈕。這是否可能是因爲某些語法錯誤?但是沒有任何錯誤信息。活動管理員不顯示所有輸入字段只是最後一個

ActiveAdmin.register Product do 
    f.input :name,:label => "Name" 
    f.input :photo, :as => :file 
    f.input :category, :collection => @category 
    f.input :manufacturer, :collection => @manufacturer 
    f.actions do 
    f.action :submit, :button_html => { :class => "primary", :disable_with => 'Wait...' } 
end 
end 
end 

產品型號看起來像這樣

attr_accessible :category_id, :description, :manufacturer_id, :name, :photo 
extend FriendlyId 
has_attached_file :photo, 
:styles => { 
    :thumb=> "100x100#", 
    :large => "290x170", 
    :medium=> "120x120"} 
friendly_id :name, use: [:slugged, :history] 
belongs_to :manufacturer 
belongs_to :category 

回答

1

你的形式應該是塊內。

ActiveAdmin.register Post do 

form do |f| 
    f.inputs "Details" do 
    f.input :title 
    f.input :published_at, :label => "Publish Post At" 
    f.input :category 
    end 
    f.inputs "Content" do 
    f.input :body 
    end 
    f.actions 
end 

下面是詳細信息 http://activeadmin.info/docs/5-forms.html

+0

感謝,這是工作:) – Edgars

相關問題