문제

I have a domain object Department that has a one-to-one relationship with another domain object DepartmentPreference. When I try to generate the scaffolding controller for Department, I'm left with a pull-down menu to select the DepartmentPreference. Since there is none yet (because DepartmentPreference has a belongsTo = Department), I can't create one.

What's the best solution you can recommend?

도움이 되었습니까?

해결책

Have you created a controller/view for DepartmentPreference like you did for Department? if not you'll need to create one or add/modify what ever existing controller/view to handle that functionality.

Since you mentioned scaffolding - I'm assuming your Department controller is defined like one of the following:

class DepartmentController {
  static scaffold = true
  ..
}

or

class SomeController {
  static scaffold = Department
  ..
}

If this Department controller - was auto generated or define with just scaffold, then it's only providing CRUD operations for Department and not any other domain classes (at least not directly). There are lot's of ways to add the missing DepartmentPreference functionality, but probably the fastest for you is to use what ever method you use to create the Department controller on the DepartmentPreference as well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top