我有这门课。
用户:
class User < ActiveRecord::Base
attr_accessible :email, :name
has_many :berichten
end
类别:
class Category < ActiveRecord::Base
attr_accessible :name
has_many :berichten
end
贝里希滕:
class Berichten < ActiveRecord::Base
attr_accessible :bericht, :user
belongs_to :user
belongs_to :category
end
之后我创建了项目。
但是当我去
http://localhost:3000/admin/berichtens
我看到这条消息出现:
undefined method `user_id_contains' for #<MetaSearch::Searches::Berichten:0x007f72300bc8f0>
那可能是因为 berichten 是一个嵌套路由,看起来像这样:
Tamara::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
resources :users
resources :category do
resources :berichten
end
end
如何解决这个问题?
罗洛夫
编辑 1:您可以在这里找到整个源代码树:https ://github.com/roelof1967/tamara_site/tree/admin_section
编辑 2:这里是开发日志:https ://gist.github.com/3933601
编辑 3:这里是控制器:https ://gist.github.com/3937461