grails

mocking command object in grails controller results in hasErrors() return false no matter what! Please help.

I have a controller that uses a command object in a controller action. When mocking this command object in a grails' controller unit test, the hasErrors() method always returns false, even when I am purposefully violating its constraints. The more baffling thing is that in production, hasErrors() works! So this is just a testing problem....

After installing the spring-security-core grails plugin, how do you get IDEA to know about the jar files?

I have installed spring-security-core in a grails project, but for some reason, IDEA didn't automatically pick up the jar files. I can deploy the app and run tests using the grails command line just fine... but IDEA still puts squiggly lines. Is there a way I can get IDEA to automatically pick up jars after I install plugins? ...

Adding business logic to a domain class using a getter style method name

I'm attempting to add a method to a grails domain class, e.g. class Item { String name String getReversedName() { name.reverse() } } When I attempt to load the application using grails console I get the following error: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...

How do I configure logging for a grails plugin ?

Hello, I'm creating my first grails plugin and I don't know where the logging should be configured. In a normal grails app, there is a conf/Config.groovy file for that, but for a plugin there is none. Is there another way to achieve this ? I would like to see debug messages when I launch my plugin unit and integration tests... Thanks ...

Grails default root path

Hi, Is there a variable where we can find out the root directory of my Grails application? I tried request.getSession().getServletContext().getRealPath("/") But shows tmp/App-Test-0.1/ . My app is located in tomcat "/home/srinath/work/projects/tomcat-6.0.18/webapps/App-Test-0.1" could any one help me . thanks in advance, sri.. ...

grails mockFor closure wierdness

Right, so when I set up my mock using the testing plugin's mockFor method, I expect a method that returns null. If I do myControl.demand.theMethod {return null} in the debugger, the value that I set the 'theMethod' call result to is some closure in the debugger. If I do myControl.demand.theMethod {->return null} the value is null...

How to make some URL mappings depending on the environment?

When getting an HTTP status code 500, I want to display 2 different pages according to the running environment. In development mode, I want to display a stackStrace page (like the default Grails 500 error page) and in production mode, I want to display a formal "internal error" page. Is it possible and how can I do that ? ...

database deign advice wanted: double data entry

hi, I'm designing a database for capturing clinical trial data. The data are entered twice by two persons, independently and the results must be matched. What are the best database tools to use to achieve the best results. Any one has similar experiences? Your helps are highly appreciated. thanks. ...

how to initialize spring bean from database

hi,i use spring security and my config is in database: <sec:http auto-config="true" entry-point-ref="casProcessingFilterEntryPoint"> <sec:remember-me /> <sec:session-management> <sec:concurrency-control max-sessions="1" error-if-maximum-exceeded="true" /> </sec:session-management> ...

Grails GSP tag to submit form with link?

I'd like to submit a form using a link instead of a submit input. Is there a tag in Grails that does this? ...

Working with the Grails g:timeZoneSelect tag?

I am wanting to use the g:timeZoneSelect tag within my application, problem is im finding the resulting html select to be quite overwhelming. Over 600 options are being displayed, IMHO this is to much to display to the user. Maybe someone could point me to an example of a much more manageable list of timezones? Maybe you have seen a si...

DynamicJasper(on Grails) Purposefully keep column or field blank(empty)

Hi, I want to generate a pdf report, where a column(or cell/field) is left blank(empty) on purpose. This column actually does have a value but, I'm choosing not to display it. The column title still needs to be displayed. Example of where this could be useful: Blank(empty) column: A comments or notes column down one side of a report....

Inheritance domain classes in Grails

Hi gurus how can I get Collection of specific Class? I use inheriance: On Planet live Human. Humans are dividing to Men and Women. class Planet{ String name static hasMany = [ humans : Human ] } class Human{ String name static belongsTo = [Planet] } class Man extends Human{ int countOfCar } class Woman extends Hu...

Batch update records in Grails

I have to calculate a "total" for each user based on individual actions -- that is, a User hasMany Actions and each Action has a point. So I need to basically get a sum of all the points on all the actions. Actions are added and subtracted regularly. Since this can be a rather heavy operation, it's not feasible that I execute the "tota...

Weird NodeBuilder and GPath behaviour in Grails

Hi, I am quite new with Grails and now I have a problem while using NodeBuilder and GPath. Here is the code snippet def builder = new NodeBuilder() def menu = builder.menu { header(title: "header 1") { submenu(title: "submenu 1.1") submenu(title: "submenu 1.2") } header(title: "header 2") } menu.grep { pri...

Grails automatic constraint update

Does grails have an automatic constraint update. If we change the field in domain class to be nullable by adding constraint, it is not getting reflected in database without schema export. Is it possible to do get grails do this update automatically. ...

grails yui richEditor and the div _firebugConsole : Why it appears in my richEditor ?

I use the richEdit yui component to my grails application. I added a constraints size:1..1000 on my grails domain class. But when I save the content of the richEditor, no validation message is rendered if the richEditor is blank. The richEditor contains automatically the message : (I use the extension firebug). How can I avoid it ...

Can a grails controller extend from a base class? How to make it so grails doesn't blow up?

I wrote a base class to help build my controllers more quickly and to remove duplication. It provides some helper methods, default actions and some meta programming to make these things easier to build. One of those methods in the base class is like this: def dynamicList(Class clazz) { def model = new LinkedHashMap() model[getM...

What web platform is right for me?

I've been looking at web frameworks like Rails, Grails, etc. I'm used to doing applications in Spring Framework with Hibernate... and I want something more productive. One of the things I realized is that while some of the things in Grails is sexy, there are some serious problems with it. Grails' controllers: 1) are implemented awfull...

How To Save Spring Security Logged In User In Session

This code get's the currently logged in user, using the Spring Security Plugin (acegi): def principalInfo = authenticateService.principal() def person = null if (principalInfo != "anonymousUser" && principalInfo.username) { person = Person.findByUsername(principalInfo.username) } I would then like to do: session.user = person T...