1
在我的應用程序,我有張控制器,型號名稱是表,但我的路線是如下慘慘的load_and_authorize_resource當資源名稱是從模型/控制器名稱不同
routes.rb
namespace :magazine do
resources :pages, :controller => "sheets" do
resources :articles do
resources :comments
使URL會雜誌/頁/ 1/article ...
在我的文章控制器中,如何調用表單的load_and_authorize_resource以便我可以訪問相關工作表的文章。 我試圖
load_and_authorize_resource :sheet, :class => 'Sheet', :parent => false
load_and_authorize_resource :through => :sheet
無法訪問@ sheet.articles ......
還是一樣..... load_and_authorize_resource:板材,:類=>' Sheet',:parent => false load_and_authorize_resource:through =>:sheet不起作用 – Oatmeal 2013-04-11 09:01:51
爲什麼你需要'parent'? – apneadiving 2013-04-11 09:08:25
在哪個控制器中,你是否想要數據? – apneadiving 2013-04-11 09:09:43