Home Grails render view with objects from other domains
Reply: 0

Grails render view with objects from other domains

user1144 Published in April 26, 2018, 1:47 pm

What I have is two, related domain objects.

First is:

class VideoCategory {

    String videoCategoryName

    static constraints = {
        videoCategoryName nullable: false

Then I have:

class Video {

    VideoCategory videoCategory
    String fileName
    String videoTitle
    String videoDescription

    static constraints = {
        fileName nullable: false
        videoTitle nullable: true
        videoDescription nullable: true

What I want is a create page for Video that will show not the videoCategoryId from the VideoCategory object, but the videoCategoryName itself in the scaffold dropdown. I want to use the id as a FK, but render the name...then upon save I want to save the id instead. I'm pretty new to Java/Groovy ways of thinking. In python/flask I might just ensure that the objects are all imported in my views and then I can call them directly and render_view with that data and then embed the id as the value for saving while render the videoCategoryName value in the markup.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.492668 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO