Grails 3.2 - defaultAction ignored on scaffolded controllers?

54 Views Asked by At

Curious if this is an issue or if I'm doing something wrong. Given the following controller:

class MetaDataTypeController {
  static scaffold = MetaDataType
  static defaultAction = 'list'

  def list() {
    render("You meant ${g.link(action: 'index', '/index')}")
  }

  def index() {
    [metaDataTypeList: MetaDataType.list()]
  }
}

accessing the application at "/app/metaDataType", I would expect to see the "list" action, with a link to "index". What I see is the "index" action. If I remove the static scaffold declaration, it works and I'm shown the link.

Is this intentional? Am I just overlooking something.

Edit: typo fixed

1

There are 1 best solutions below

1
On

Do as like that

class MetaDataTypeController {
  static scaffold = MetaDataType

  def index() {
        redirect(controller:'MetaDataType',action:'list')
    }

  def list() {
        [metaDataTypeList: MetaDataType.list()]
    }