I tried to override the dynamic method addTo* provided by Grails/GORM but it doesn't seem to work.
Here is the code :
class Match {
static hasMany = [players: Player, matchPlayers: MatchPlayer]
void addToPlayers(Player player) {
if (players.add(player)) {
MatchPlayer matchPlayer = new MatchPlayer(match: thi...
I've encountered a Groovy meta-programming problem which I'm unable to solve.
When adding the static method foo() to the class FooBar, then FooBar.foo() works as expected:
FooBar.metaClass.static.foo = {
println "hello"
}
FooBar.foo()
However, I instead add the same static method foo() to the class Object, then FooBar.foo() fails...
In my Grails controller I'm responding to an AJAX call and using render to return the text:
def ajaxRandomPersonName = {
def person = get a random person ...
render "Name: ${person.name}"
}
The problem is that render renders the whole template. So instead of just rendering "Name: John" it renders all the icons, navigation, etc...
I am new to groovy/grails, and I'm trying to to do a criteria search that finds all posts for a month, basically like this:
def getUserMinutesForYear(User user, Date date){
Date firstDate = new GregorianCalendar(date.year, Calendar.JANUARY, 1, 0, 0, 0).time
Date lastDate = new GregorianCalendar(date.year, Calendar.DECEMBER, 31,...
It seems that with g:formRemote and g:submitToRemote, I can only specify one update target div. What would be a viable strategy for updating multiple divs?
...
I'm using grails and want to use an in-house custom JSP taglib in the project. Does anyone know how to do this? I've seen references to getting other jsp taglibs working but not if you've written them yourself. I have a jar file called 'common-view.jar' in the lib folder and have tried this code to reference it:
<%@ taglib uri="${cre...
I am building a web application using Grails. I decided to use dojo and I added a dojo fisheye menu for begining in the main.gsp so it would be available on all the application's pages.
It works fine for the (home) index.gsp page, but once I select another one, the fisheye menu disapears. If I go back to home it is there. I revised my se...
I'm working on a Grails 1.0.4 project that has to be released in less than 2 weeks, and the customer just came up with a requirement that all data in the database should be encrypted.
Since encryption of every database access in the application itself could take a lot of time and will be error prone, the solution I seek is some kind of ...
I have a g:select in my view that displays a list of products:
<g:form name="addproductform" action="saveProductToInventory" method="post">
<g:select from="${products}" name="product" value="${it?.id}" />
<g:hiddenField name="inventory.id" value="${inventoryInstance.id}" />
<input class="save" type="submit" value="Save produ...
Can someone please help me to figure out how to create domain classes for simple one-to-one mapping in grails !
let say we have 2 tables (oracle):
create table table_a(long_common_id_name number(5) primary key using index,
notes varchar2(10 byte),
update_seq number(3)not null );
create table table_b (long_common_i...
In Grails, is "property" a reserved word? That is, can I name a domain class Property and have its owner reference it by properties? Example:
class Thing {
static hasMany = [properties: Property]
}
class Property {
static belongsTo = [thing: Thing]
}
When I try to add a Property to a Thing I get the error:
Exception thrown: ...
I have two domain classes - Person has many Books. If I create a
Person, call save(), then create+add Books to the Person, everything
is persisted to the database. If I create a Person, then create+add
Books, followed by save(), nothing get persisted.
Example code:
class Person {
...
static hasMany = [books: Book]
}
class Book {...
I'm using the PersistentTokenBasedRememberMeServices (Spring Security 2.04) in Grails App in conjunction with the OpenIDAuthenticationProcessingFilter. The configuration is as follows (This is Grails's DSL equivalent to Spring resource.xml but it should be quite easy to adapt):
customTokenRepository(JdbcTokenRepositoryImpl)
{
dataSour...
DO I need to inject the JavaMail Objects into the application context and access my inbox the old fashion way or is there some "magic" in grails to handle it for me?
...
Hi,
I need to use XML file to store each key/value pair used by my app (instead of the usual properties file).
Grails is using properties file by default to handle internationalization.
What can I do to configure grails to read internationalization information in XML file?
Thanks
...
I want to monitor my Java Heap Space.
Since i got the infamous Java Heap Space i raised the heap space.
But i want to monitor how the need of space from my Application is.
Additional Info (not sure if it is needed):
-Using Netbeans for creating Webapps with Grails
-Application Server is Glassfish and Tomcat
...
For my Grails App i use Searchable Plugin to have an nice "google-like" Search.
I followed instructions and added:
class Address {
static searchable =true
Integer id
AddressGroups addressType
String briefDescription
String company
}
It really works fine.
The Problem here is that the Sea...
How can I call a native shell script from a Groovy / Grails Application?
The shell script resides on the same machine.
...
Can someone explain how to define multi column indexes in Grails? The documentation is at best sparse.
This for example does not seem to work at all:
http://grails.org/GORM+Index+definitions
I've had some luck with this, but the results seems random at best. Definitions that works in one domain class does not when applied to another (w...
Hi,
Nowadays I hear a lot about "Groovy on Grails" and I want to know about:
What is Groovy ?
What is Grails ?
What kinds of Application are built using Groovy on Grails ?
Thanks.
...