4

我只是在尝试 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)

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

谢谢

4

2 回答 2

0

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

于 2012-12-15T20:39:14.210 回答
0

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

如果您想为不是模型的东西注册一个页面并且您已经注册了它,请将 .rb 中的 ActiveAdmin.register NAME 替换为 ActiveAdmin.register_page "NAME"

于 2012-12-14T22:38:59.987 回答