Grails 2.3.4 and Grails Tool Suite 3.5.0 M1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails 2.3.4 and Grails Tool Suite 3.5.0 M1

briosche
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.3.4 and Grails Tool Suite 3.5.0 M1

longwa
You should ask this question on the user list. This list is for development of the Grails framework itself, not for usage questions.


On Wed, Jan 15, 2014 at 5:40 PM, briosche <[hidden email]> wrote:
Hi,
I am doing my first web application with grails tool suite 3.5.0
and i have an issue:

for example:

create Grails project example

create domain class User and Role into the same package it.domain

---------------User----------------
package it.domain

class User {
String username
String password
String name
String surname

static belongsTo = [role: Role]

static constraints = {
        username(blank: false, unique: true)
        password(password: true, blank: false, nullable: false, size:6..40)
        name(nullable:true, blank: true)
        surname(nullable:true, blank: true)
    }

String toString() {
                "${name}"

        }
}


---------Role-------------
package it.domain

class Role {
        String authority
        String description

        static hasMany = [ users: User]

        static constraints = {
                        authority(blank: false, unique: true)
                        description(nullable:true, blank: true)
                }

        static mapping = {
                users cascade: 'all-delete-orphan'

        }

String toString() {
        "${authority}"
        }
}

------------------------------
generate controller and views for User and Role

run-app example

create new roles
a   (role 1 created)
b   (role 2 created)
c   (role 3 created)

delete b  (role 2 deleted)

create  b (role 4 created)

if you delete b
you keep an error (role not found with id 2)

If you remove:

String toString() {
        "${authority}"
        }

from domain class
everything works fine.

i need to list  roles by authority in view user/create
but i erase the code from domain class
String toString() {
        "${authority}"
        }
I see only
it.domain.Role:  1
it.domain.Role:  2
it.domain.Role:  3


Can You help me please?

kind regards







--
View this message in context: http://grails.1312388.n4.nabble.com/Grails-2-3-4-and-Grails-Tool-Suite-3-5-0-M1-tp4653336.html
Sent from the Grails - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email