grails

RenderAction- / Cell-like functionality in Grails

Hi, do you know if there's an equivalent in Grails to ASP.NET MVC's Html.RenderAction also found in Ruby on Rails as Cells? The basic idea is that you can render something but the decision what to render is passed on to a different controller. So for example if you have a shopping cart's preview on the page that it's not taken from the ...

Can a Grails Layout call a template?

I want my main layout to conditionally put in some blocks of html that I want to be defined in a separate file. I have more than one kind of navigation bar defined. I want to have a file for each navigation bar. Then I want to just set a variable in my controller or specific gsp file so that the layout chooses which navigator to use. ...

GORM list() to return superclass objects only

I have a simple object hierarchy, and I want to query each of the objects using list(). The problem is that because of polymorphism, Task.list() returns both instances of type Task and ComplexTask. class Task { } class ComplexTask extends Task { } I realize I can solve my problem by having a common abstract superclass, or filter r...

IntelliJ IDEA 9.0 - unable to select project SDK for Grails application

I'm convinced that I'm just having a bad day and missing something obvious. I'm trying to create a new Grails project in IntelliJ IDEA 9.0 and I am unable to associate it with an SDK. I've tried creating a project from scratch and creating a project from existing sources. In either case, I get to the "Please select project JDK" screen...

Turning a screenshot into a prototype with Grails

We're beginning to design a new product, and our UI guy is knocking out screenshots like there's no tomorrow. Our boss, though, wants to be able to actually interact with the site as it would look with various features and skins. I can whip up simple features pretty quickly with Groovy on Grails (or any of a dozen other options), but w...

Can a Grails Domain Class inherit from a class that is not a domain class?

I tried to do this, but it insists on their being a table of the base class. I tried using tablePerHierarchy false as well and that didn't make any difference. I have a few domain classes that share a bunch of methods that operate on an inherited transient field. I had hoped that just having the class over in the non-domain secti...

Grails - How to create with model constraints a drop down list for representing belongsTo ?

I'm learning grails, and I have a problem. I have 2 classes, lets say: class Book { String name String description static belongsTo = Category Category category static constraints = { name(nullable:false, blank:false) description(nullable:true, maxSize:5000) } clas...

How to execute a Groovy Script from my Grails app?

Well, it seems a simple task but I didn't manage to make it run. I have a groovy script that runs fine under Windows Vista when calling from prompt: > cd MY_GAILS_PROJECT_DIR > groovy cp src/groovy scripts/myscript.groovy Now, I want to execute this script (and passing to it some input arguments) through my my Maintenance Service Cla...

Groovy: Sorting Columns in a view: list

Hi! I have a Groovy application. I am rendering the view list using the following statement: render (view: 'list', model:[reportingInstanceList: reportingInstanceList, reportingInstanceTotal: i, params: params]) The list.gsp is as follows: The view is rendered but the default sorting is not working. <g:sortableColumn class="tabtitle...

Is it normal that my Grails application is using more than 200 MB memory at startup?

My Grails application is running in a development environment. I still didn't go into production, but in any case, is it normal that my Grails application is requiring 230 MB at startup only (with an empty bootstrap and no request handled so far)? Do you know why this is the case, how to improve memory usage in development mode and, mos...

Mapping hasMany = [field:String] to a database field TEXT

Is it possible to set the database column type of a hasMany association to a primitive type (in my case string) to a specific value? I know how to set a field (see this question), but this is different. List textRecords static hasMany = [ textRecords:String, ] I want to make sure that my textRecords are mapped to a TEX...

Groovy object array creation question

why does this throw an exception? messageSource.getMessage('UserService.msg.forgot.unknown', ["[email protected]"], null) unless I do this... def Object[] args = ["[email protected]"] messageSource.getMessage('UserService.msg.forgot.unknown', args, null) ...

Using bindData method outside of controller

I was wondering if anyone had an idea for the best way to provide the functionality of bindData() outside of my grails controllers. In my current project I have created several groovy classes to model objects returned by an api. In these classes I have a static method that parses xml and returns a List of objects of the class. I would li...

Grails Ant Task to create a WAR

I am trying to package a grails war inside a JEE ear. I have noticed that when I call grails war all the jars defined in the default dependencies are picked up and put into the WEB-INF/lib. But when I run the grails ant task to war the application, it picks up only the jars in the plugin folders. I am using Grails 1.1.1. It seems to me t...

Is there a way to configure in Grails access to two different schemas of the database?

Hello: I need to access from Grails to several different tables that are in different schemas. The user has access permissions to all the tables, but , when I try to map the Domain classses to the tables, I can't find a way to get it done. I've tried to map the domain this way: static mapping = { table 'SCHEMA2.TABLE' ...

Case Sensitivity and Indices in MYSQL

I am creating a system where is use e-mail address as unique identifier. There are times I need to look for a user by the e-mail address. If the user enters the e-mail address in all lower case, but the database has it stored as mixed case, is it a full scan, or will the database still use the index? This really is a problem because I ...

Ascii to Int function in Groovy

Hi, I'm trying to pass the value "1" into a Grails tag. However, it turns out to be an integer value of 49 - the ascii value for "1". How do I convert this to the proper value in Groovy? ...

301 redirects in Grails

I'm currently doing my Grails 301 URL-redirects using the following quite cumbersome "servlet style" method: def action = { ... if (shouldRedirect) { response.status = 301 response.setHeader("Location", "http://url/to/redirect/to.html") render("") return false } ... } Is there any cleaner and more compact Groov...

In Grails template namespace how do you use a template that is in another directory

Say I have a template called /sample/_mytemplate.gsp. If I want to call this template from the same directory I can use However, what if I am in another directory. Then what do I do? Say I'm in the view /sample2/mypage.gsp how do I call it? ...

Is learning Java and related technologies worth it today?

My career has always been C and C++ programming. I have some basic Java experience. I have a lot of personal Ruby/Rails experience and lately I've been doing some Grails stuff at work as well. I'm just curious if it's worth it to pick up Java and related technologies such as Spring, Hibernate, etc... Grails seems like it removes the n...