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.
Add this to VideoCategory class:
String toString() {
return videoCategoryName
}