Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8450477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:58:43+00:00 2026-06-10T10:58:43+00:00

I am using grails 2.0.1. I create a user and under this user I

  • 0

I am using grails 2.0.1.
I create a user and under this user I create a child.
Each child will then have their own page.

How would I access the details in the child domain from the profile page?

User domain as follows:

String username
String password
String email

static hasMany = [children:Child, followed:User]

Child domain as follows:

String firstname
String otherNames
String lastname
Date dateOfBirth

I think I need to add a

static belongsTo = User

in the Child domain.
But I am not sure how I can access this in a controller. As a user can have many children and I need to know which one has been selected.

Also can you add a variable to be passed when using a g:link tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:58:45+00:00Added an answer on June 10, 2026 at 10:58 am

    I am not sure what the profile page is, I’m assuming it is a page to view the User properties. Please post the code if this is not the case.

    To access the children of the User, you can simply refer to yourUser.children. This simply returns a Collection, so you can iterate over it, grab the first one, etc. If you need a specific child that was selected from a gsp, you will need to pass its id (or code, or some other unique identifier) to your controller action, and find it from your User. I’m assuming that’s what you mean by your second question.

    As for the g:link, yes you can pass a variable, like so:

    <g:link action="yourAction" params="[childId: childId]">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Grails 2.0.0 project that was created using grails create-app . In
We are using grails-groovy with Hibernate, I have a SQL query like this in
In my Grails 1.3.7 project I have a domain class like this: class User
I want to create war using grails, but by default it creates war file
Using Grails database-migration I have a table in production defined like so: +--------------+------------+------+-----+---------+----------------+ |
I'm considering using Grails for my current project. I have a couple of requirements
I'm using Grails 1.3.7 and the db-migration plug-in. I have generated a chagelog.groovy-file containing
I am trying to create a simple portlet for Liferay 5.2.2 using Grails 1.2.1
I'm using Grails scaffolding and would like to make a change in the default
We have a Grails 1.3.7 Application and are using Webflow for a 2 step

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.