FAQ Database Discussion Community


How to delete a child domain row in grails

oracle,grails,gorm,grails-2.0,grails-domain-class
I am saving data to my entry meeting table as well as entry meeting details table which is a child table of entry meeting table. But When I want to delete only a child table record it's giving a error. I can't understand what to do. I am using grails...

Grails 2.4.4 unable to create codecLookup bean

grails,grails-2.0
I'm upgrading a 2.3 app to 2.4.4 and I'm getting a weird error at startup: Caused by BeanCreationException: Error creating bean with name 'codecLookup': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank...

grails g:each tag is not showing anything in view

grails,grails-2.0
I am using grails 2.4.2. I need to show some value in view from a list. That's why I am using g:each but nothing is shown to view although it's working fine in controller. I never saw this issue before. Can anybody please help me on this please ?!!! Here...

Grails: g:link not applying params with dynamic keys

grails,grails-2.0
I'm trying to create a link with a dynamic link like: <g:link action="${nextDashboardUriMap.nextAction}" params="${["$nextDashboardUriMap.queryStringId": "$entityId" ]}"> ${entityName} </g:link> where nextDashboardUriMap.queryStringId contains xyz and entityId contains 12. I was expecting url of the link to be http://website.com/controller/action?xyz=18 but <g:link/> consistently gives me http://website.com/controller/action?xyz. I have tried replacing entityId with a string...

Grails: What is the difference between using actionName and pageScope.actionName inside taglibs?

grails,grails-2.0,gsp,taglib,grails-controller
In my company's codebase I'm seeing pageScope.actionName being used. Is it safe to droppageScope? Update: I am interested in knowing whether actionName is a late addition to the framework that makes pageScope.actionName obsolete. Update 2: Here is how it is used in one taglib: def url = "/${pageScope.controllerName}/${attrs.action}" ...

Failing to save during Test on Controller

unit-testing,grails,testing,grails-2.0,spock
I have been struggling with this for quite sometime and it seems like a common problem, with no solution that worked for me. What I am trying to do is test the controller which calls a save(), and inside the save() the method calls a service to save the employee...

Grails Url shortener plugin not getting installed

grails,grails-plugin,grails-2.0,url-shortener
I am trying to add a new plugin mentioned here in my app but it is not been resolved and giving me a error i.e. :: problems summary :: :::: WARNINGS module not found: org.grails.plugins#url-shortener;0.2.1 ==== grailsPlugins: tried -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: ... ==== grailsHome: tried /opt/grails/lib/org.grails.plugins/url-shortener/ivy-0.2.1.xml -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: /opt/grails/lib/org.grails.plugins/url-shortener/jars/url-shortener-0.2.1.zip...

How modify value of attributes passed into Grails GSP

grails,grails-2.0
I require to be able to change the value of a bean (attribute) passed into a gsp. Am using grails 2.3.11. see code below - this does not modify the bean - please can you inform how it can be done? At line #1 this is an attempt to replace...

Grails web-app image directory is not working properly in war

tomcat,grails,debian,grails-2.0
I am working with Grails 2.4.2. I am saving images to a directory named gameImage under web-app folder. It's working perfectly in development mode. But when I run the war on localhost in the xampp server then in the view image is not showing but saving in the directory. Here...

How to show parent domain field in select box in grails

grails,gorm,grails-2.0,grails-domain-class,grails-controller
I am using grails 2.1.0. I need to show a parent domain's field value through parent chain in select box in a gsp page. But I am getting error. So far I have tried as follows :: my first domain which contains parents as named adtAuditPack >>> class AdtAuditorSchdlPack {...

Spock @Unroll annotation

grails,grails-2.0,spock
During a recent code review, the question came up regarding whether the @Unroll annotation belongs at the class level or the method level. The class in question requires @Unroll on most of its methods but not all of them. Does declaring @Unroll incur any performance penalties if declared at the...

Render a controller into a String

grails,grails-2.0
I can render a template or a view into a String, but how can I render a controller into a String ? I would like to perform this kind of operation: def myAction = { ... def html = renderToString(controller: 'myController', action: 'myAction', params: [what:'ever']) render modify(html) ... } ...

Render a GSP page to a file in a web-app subfolder

grails,grails-2.0,print-css
I need a really stupid thing but I'm stuck. I need basically to render a gsp page and save the rendering locally on server side inside a folder I created under web-app/. Basically the output of this: render(view: "report-test") must be saved in a file as example report-test.html inside a...

Grails: Do addTo* and removeFrom* require a call to save?

grails,gorm,grails-2.0,grails-domain-class
In the docs some examples have a call to save whereas some others do not. I'm assuming that addTo* needs the call to save whereas removeFrom* doesn't. Am I mistaken?

Decompression of GZIP:ed response (Grails / Groovy)

rest,groovy,gzip,grails-plugin,grails-2.0
I'm consuming a REST api using the RestBuilder plugin. I get a response where the body is compressed: Content-Encoding=[gzip] Does groovy/Grails provide any easy access / native methods for decoding gzip compression? The only thing I found is the native Java zip api (ex. GZIPInputStream). Does someone have a better...

Set property method in grails could not change the instance globally

grails,grails-2.0,grails-domain-class
I have a domain class DbUserSchemaServer with a transient property unassign class DbUserSchemaServer { static transients = ["unassign"] DbUser user String schema DbServer server BigInteger objects Date creationDate String schemaStatus //for dropping Boolean protect //Transients Boolean unassign static constraints = { user unique:false, nullable: false, blank:false schema unique:'server', nullable: false,...