简体   繁体   中英

grails 3.0.1 scaffolded view does not show domain relationship

I am following the example in the book "Grails a Quick-Start Guide" using Grails 3.0.1 with following domains

package com.tekdays

class TekEvent {

    static constraints = {
        name()
        city()
        description maxSize:5000
        organizer()
        venue()
        startDate()
        endDate()
    }

    String city
    String name
    TekUser organizer
    String venue
    Date startDate
    Date endDate
    String description
    static hasMany = [volunteers: TekUser, respondents: String]

    String toString(){
        "$name, $city, $organizer"
    }

}

And

package com.tekdays

class TekUser {

String fullName
String userName
String password
String email
String website
String bio

String toString() { fullName }

static constraints = {
    fullName()
    userName()
    email()
    website()
    bio maxSize:5000
}
}

After that I used

grails generate-all "*"

And then init/BootStrap.groovy

class BootStrap {
def init = { servletContext ->
    def user1 = new TekUser(fullName: 'John Doe',
                            userName: 'jdoe',
                            password: 't0ps3cr3t',
                            email: 'jdoe@johnsgroovyshop.com',
                            website: 'blog.johnsgroovyshop.com',
                            bio: '''John has been programming for over 40 years. He has
                                    worked with every programming language known to man
                                    and has settled on Groovy. In his spare time, John
                                    dabbles in astro physics and plays
                                    shuffleboard.''').save(flush: true, failOnError: true)
    def event1 = new TekEvent(name: 'Gateway Code Camp',
                            city: 'Saint Louis, MO',
                            organizer: TekUser.findByFullName('John Doe'),
                            venue: 'TBD',
                            startDate: new Date('11/21/2013'),
                            endDate: new Date('11/21/2013'),
                            description: '''This conference will bring coders from
                                        across platforms, languages, and industries
                                        together for an exciting day of tips, tricks,
                                        and tech! Stay sharp! Stay at the top of your
                                        game! But, don't stay home! Come an join us
                                        this fall for the first annual Gateway Code
                                        Camp.''')
    println "before event1.save"
    if(!event1.save()){
        event1.errors.allErrors.each{error ->
            println "An error occured with event1: ${error}"
        }
    }
}//init

def destroy = {
}
}

When I visit http://localhost:8080/tekEvent/show/1 it shows all the properties except the TekUser property as shown in the screenshot

![1]: http://i.stack.imgur.com/sJaZu.png

您所看到的是此问题https://github.com/grails3-plugins/fields/issues/1 ,该问题在解决后将得以解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM