【问题标题】:Grails generating scaffold for another domainGrails 为另一个域生成脚手架
【发布时间】:2017-07-29 16:50:19
【问题描述】:
Grails Version: 3.2.7
Groovy Version: 2.4.7
JVM Version: 1.8.0_111

我创建了 2 个控制器和 2 个域

第一个域:

package beermembers

class First {
String first
    static constraints = {
    }
}

Seconf 域:

package beermembers

class Second {
String second
    static constraints = {
    }
}

第一个控制器:

package beermembers

class FirstController {
    static scaffold = First
    def index() {
    }
}

第二个控制器

package beermembers

class SecondController {
    static scaffold = Second
    def index() {
    }
}

我正在开始申请,并认为会是

http://localhost:8080/first/index with CRUD for First domain

http://localhost:8080/second/index with CRUD for Second domain

但它在两个 url 上都显示 First 的 CRUD。

能否解释一下为什么 SecondController 会显示 First 域信息?

【问题讨论】:

  • 看起来像 grails 3.2.7 版本中的一个错误,我已经尝试过 grails 2.4.7 和它的工作正常,但 3.2.7 给了我和你面临的同样的问题。尝试重命名 SecondController(例如 MyController),它会起作用。
  • 重命名没有帮助。我还发现,如果我重新启动应用程序并进入 Second,它将显示 New Second。但是,如果我去 First,那么它将显示 New Second。所以它显示了我为所有人打开的第一页。想报告错误,但来自官方网站的jira.grails.org 链接不起作用。与“grails bug-report”相同

标签: grails scaffold


【解决方案1】:

发布了与 Grails 3.2.7+ 兼容的新版脚手架插件

使用 3.3.1 版的脚手架。

这里是相关问题https://github.com/grails/grails-core/issues/10520

【讨论】:

  • 非常感谢。将 build.gradle 字符串从 'compile "org.grails.plugins:scaffolding' 更改为 'compile "org.grails.plugins:scaffolding:3.3.1'。作品
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-10
  • 1970-01-01
  • 1970-01-01
  • 2012-03-02
  • 1970-01-01
  • 2012-05-22
相关资源
最近更新 更多