gorm


Grails - 2 domains and 1 form create/update/edit issues


Having some mega frustration set in.Maybe Im trying grails too much like rails and active record.
I have 2 domains.The parent is called 'report' and the child 'category'.
The user creates a new report and if they like they can add a category. The report can only have one category. However I would like to allow reports to be sorted by category or listed by category or even counted by category. Yes this column could go into the reports domain but I would like separation for future cases. so below I have my domains;
Domain 1 = Report
class Report
string reportname
string reportype
Domain 2 = category
class Category
Report report
string categoryname
I have 2 controllers, 1 for report 1 for category both with crud methods and no scaffold.
How do I set the view to create/edit/update the category domain while in the report _form?
I have read through the gorm docs, grails docs, others but still am stumbling on this.
Do I need to edit my report controller to handle the category domain? i.e import category and supply category def with each method for /edit/update/create.
Do I need to edit the report form to get the report params and pass this into a hidden field for the category name field so that when a save action is called the category domain commits the cat name and reportId.
Is my model all wrong? I have tried hasone, hasmany belongsto however I need to keep the category separate from the reports because I want to be able to show a page of reports separated by categories and allow only unique category names for a bunch of reports to reduce spelling mistakes in category names. i.e. I want to set a category name and associate it to a report.
New to grails so forgive me. Maybe I need to sit and have a beer and read more.
cheers
There are many ways to handle your scenario. One way to do this is to use redirect in your ReportController and pass in the params to CategoryController.

Related Links

use of mappedBy in Many to Many relationship in Grails
Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?
How to avoid ImprovedNamingStrategy in joinTable in Grails
Grails 2 Show transient property that is an alias for id column
How to save GORM class with composite id made from its own field?
Grails - 2 domains and 1 form create/update/edit issues
Is there a belongsTo mixed syntax for GORM many-to-many and back-reference
Why do these Gradle tests throw exceptions?
In grails 2 when using multiple datasources, can I specify which datasource a criteria should use?
GORM methods are not accessible in Domain and Service classes
How to initialize the domain class properties with the values of another Domain class properties in grails
Grails Domain Embedded
How to get count of all items in a criteria GORM query

Categories

HOME
ms-access
compiler-construction
yii2
amazon-ec2
hp-exstream
vmware
android-4.4-kitkat
yarn
jgroups
fsm
cross-validation
synchronization
slick-slider
windows-10-universal
facebook-php-sdk
vifm
qt-creator
jplayer
quartz-scheduler
vaadin7
highlight.js
excel-vba-mac
object-detection
one-hot-encoding
scriptcs
errorlevel
intentfilter
ehcache
facebook-instant-articles
excel-2007
jndi
shopware
xpages-ssjs
google-cloud-nl
bcd
phonegap
create-table
fog
stringtemplate
mozilla
mapbox-gl
html5-fullscreen
ios5
overlap
appfabric
suricata
devextreme
jquery-bootgrid
mixture-model
impersonation
bootstrapper
user-controls
outlook-api
node-sass
sencha-touch-2.3
executenonquery
babel-core
dotcover
logparser
jxcore
slickedit
libusb-win32
capacity
dynamics-sl
orthogonal
home-directory
transmitfile
autorest
markojs
blackberry-10
hill-climbing
yaws
rhino-servicebus
tarjans-algorithm
dukescript
clicktag
cctv
client-side-templating
gulp-less
websocket4net
aapt
valueconverter
valuechangelistener
picturefill
java.nio.file
c18
runtime.exec
pushbackinputstream
smtp-auth
nsnetservice
venn-diagram
dsn
jspinclude
onsubmit
reddot
ohm
netdna-api
infobox
locate
visitor-statistic
dmx512
mozilla-prism
user-friendly
webkit.net
iweb
procedural-music
misv

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App