Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Owner {
- static hasOne = [ owned:Owned ]
- }
- class Owned {
- Owner owner
- }
- class OwnedController {
- def save = {
- def owner = Owner.findById(1)
- owner.owned = new Owned()
- owner.save()
- redirect(controller:"owner", action:"view")
- }
- }
- class OwnerController {
- def view = {
- [owner:Owner.findById(1)]
- }
- }
- //owner/view.gsp
- owned exists: ${owner.owned != null}
- //outputs owned exsits: false consistantly
Add Comment
Please, Sign In to add comment