문제

I have 3 domain classes: Article, User & Language. Every article is written by a user in a specified language. So the relation are (Article - Language : many - 1), (User - Article : 1 - many)

I try:

class Product {

  static belongsTo = [user:User]
  static belongsTo = [language:Language]

  ...
}

class User {

  static hasMany = [products:Product]

   ...
}

class Language {

  static hasMany = [products:Product]

  ...
}

Here's the problem: grails generate-all can create all the controllers & views for all 3 domain class, but with no properties input in any view. No text input, no combo box, no error message,... only the id field for Product, Language, and Article.

I'm pretty sure the error is about how I use relationship, because when I drop "belongsTo" & "hasMany", grails create all the view without any trouble.

Did I do anything wrong?

도움이 되었습니까?

해결책

You can explicitly add a property user (camel-case) to Article, and scaffolding will generate for it. Or you can tweak scaffolding template (after grails [install-templates][1]) to use not only explicitly declared properties.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top