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

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
'Requested bean is currently in creation' on a domain object
GORM 1:N Association Cascades Delete Without belongsTo!

Categories

HOME
openlayers
clips
cookies
omnet++
drivers
kde
plone
react-router
at-command
rdf
node-pdfkit
google-apps-marketplace
try-catch
object-detection
captiveportal
crystal-reports-2010
sparse-matrix
fish
su
fgetcsv
web-api-testing
windows-server-2000
tasklet
twitch
ssjs
temporary-files
galen
gulp-sourcemaps
nand2tetris
netcdf4
scorm
azure-application-gateway
qsslsocket
prolog-setof
celery-task
jlink
slickedit
worker-thread
lift-json
memory-alignment
zendesk-app
chord-diagram
gnome-shell-extensions
background-service
pintos
parallel-data-warehouse
azure-sdk
probability-density
elements
packagist
pervasive-sql
vhd
marching-cubes
dukescript
notify
jscript.net
websocket4net
tld
p4java
doskey
mechanize-ruby
quantlib-swig
easy-install
batterylevel
buster.js
gwt-rpc
limejs
eventlistener
html-editor
viewswitcher
postgresql-performance
pendrive
cufon
libc++
genshi
krl
iphone-web-app
site.master
yslow
database-management
premature-optimization
private-members
data-acquisition

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App