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

GORM (varchar .save(), non DATE): ORA-01861: literal does not match format string
GORM addTo methods not found in Spock test
spring-boot property exception while externalizing datasource properties and using actuator
Mapping hasMany relation and saving the related data
Method on class [] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails Correctly
What happens when two app servers in cluster start LiquiBase update (via Grails)?
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

Categories

HOME
vim
netbeans
minimum-spanning-tree
layout
lodash
alfresco
spagobi
gps
serverspec
u-sql
static-libraries
percona
vaadin7
systemc
lucene.net
lldb
introduction
zapier
opencover
graphicsmagick
hammerspoon
icloud-api
blazemeter
h2db
entitlements
wtx
newline
bluestacks
google-rich-snippets
kendo-ui-grid
mmenu
ios5
dartium
objectlistview
elasticsearch-plugin
cookiecutter-django
dynamic-reports
password-encryption
no-www
mime
wptoolkit
fault
scrollable
jquery-nestable
promela
datastax-startup
nstextview
smart-table
topbeat
autorest
multiple-regression
lua-5.1
yaws
oauth2client
lib.web.mvc
teamcity-8.0
endeca-workbench
pundit
deis
sailfish-os
mmc
clipperlib
sorl-thumbnail
jsonpickle
preferences
html-helper
openexr
yorick
comexception
java.nio.file
openlaszlo
xsockets.net
dexterity
spring-io
ftps
flash-builder4.5
buster.js
gridcontrol
free-variable
sublist
isnullorempty
javaspaces
wse3.0
amazon-appstore
removeclass
adk
nsdatecomponents
joyent
f#-powerpack
winbugs14
radcombobox
sudzc
dentrix
ctp4
pascal-fc
gacutil

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile