ActiveAdmin 和 "uninitialized constant InheritedResources::Base"



我只是在尝试ActiveAdmin。我已经有了仪表板和一些资源,但是现在当我运行例如一个 rails 生成器时,我得到了:

% rails generate scaffold Post name:string
.../.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing': uninitialized constant InheritedResources::Base (NameError)
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/base_controller/menu.rb:2:in `<module:ActiveAdmin>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/base_controller/menu.rb:1:in `<top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/base_controller.rb:2:in `<top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/resource_controller/actions.rb:2:in `<module:ActiveAdmin>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/resource_controller/actions.rb:1:in `<top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/resource_controller.rb:2:in `<top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/batch_actions.rb:7:in `block in <top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/event.rb:25:in `call'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/event.rb:25:in `block in dispatch'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/event.rb:24:in `each'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/event.rb:24:in `dispatch'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/application.rb:179:in `load!'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin/application.rb:205:in `routes'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/activeadmin-0.5.0/lib/active_admin.rb:79:in `routes'
    from .../lap-app/config/routes/routes.rb:27:in `block in <top (required)>'
    from .../.rvm/gems/ruby-1.9.3-p194@lap/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
    ...

routes.rb:27是:

ActiveAdmin.routes(self)

我没有发现任何对我有用的东西:((

谢谢

您是否不小心注册了不是模型的东西(使用 rails g active_admin:resource NAME)?ActiveAdmin.routes(self)会为已注册的资源自动生成CRUD路由,因此这些已注册资源之一实际上可能不是。

如果要为非模型的内容注册页面,并且已经注册了它,请将 ActiveAdmin.register NAME 替换为 .rb 中的ActiveAdmin.register_page"NAME"

尝试将ActiveAdmin.routes(self)移动到顶部,而不是在routes.rb文件的中间或末尾。

相关内容

  • 没有找到相关文章

最新更新