2013-08-16 75 views
0

我有此導軌ActiveAdmin belongs_to的admin_inicio_bannerhomes_path()

class Inicio < ActiveRecord::Base 
    has_many :bannerhomes 
end 
class Bannerhome < ActiveRecord::Base 
    belongs_to :inicio 
end 

和activeAdmin有這種

ActiveAdmin.register Inicio do 
    sidebar "Project Details" do 
     ul do 
     li link_to("Bannerhome", admin_inicio_bannerhomes_path(Inicio)) 
      #it dont work with Inicio and inicio, why dont work? 
     #li link_to("Bannerhome", admin_inicio_bannerhomes_path(1)) 
      #when i pass 1 it works, but i want every Bannerinicio that belongs to Inicio with id=1 
     end 
    end 
end 

ActiveAdmin.register Bannerhome do 
    belongs_to :inicio  
end 

我有一個與INICIO ID = 1和4 Bannerhome使用id = 1,2,圖3和4,每一個都inicio_id = 1

即時遵循這個文檔 http://www.activeadmin.info/docs/2-resource-customization.html#belongs_to

謝謝。

回答

0

我有同樣的問題,似乎文件缺乏一些東西。加:only => :show,所以側欄只出現在動作中,其中inicio可用

sidebar "Project Details", :only => :show do 
    ul do 
    li link_to("Bannerhome", admin_inicio_bannerhomes_path(inicio)) 
    end 
end 
相關問題