rails 3.1:如何覆盖Inherited_resources,并允许rails脚手架再次正常工作? [英] rails 3.1: how override inherited_resources and permit rails scaffolding to work normally again?

查看:57
本文介绍了rails 3.1:如何覆盖Inherited_resources,并允许rails脚手架再次正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发现的解决方案:请参阅注释

SOLUTION FOUND: See comment

构建新的Rails 3.1应用程序。从一个基本的blog_entries模型开始就可以了。没什么好奇怪的

Building a new rails 3.1 app. Started with a basic blog_entries model to get the hang of it. No surprises.

然后我添加了ActiveAdmin,使我的现有模型可以正常工作。

Then I added ActiveAdmin, got that working okay with my existing model.

但是现在,当我尝试使用以下方法来搭建新模型时:

But now when I try to scaffold a new model/etc with this:

rails g scaffold Community name:string guid:string

一切似乎都正确(视图,迁移),但控制器没有CRUD选项,并且看起来像这样:

everything seems right (views, migration) except the controller does not have CRUD options and looks like this:

class CommunitiesController < InheritedResources::Base
end

问题是ActiveAdmin使用Inherited_resources阻止了手动导轨的脚手架

The problem is that ActiveAdmin uses inherited_resources which prevents manual rails scaffolding from working normally.

即使ActiveAdmin使用Inherited_resources,有人知道有一种方法可以强制正确地支撑rails?

Does anyone know a way to force rails to scaffold "correctly" despite ActiveAdmin using inherited_resources?

推荐答案

您可以执行以下操作来覆盖 inherited_resources

You can do the following to override inherited_resources:

-c=scaffold_controller

这篇关于rails 3.1:如何覆盖Inherited_resources,并允许rails脚手架再次正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆