Grails
  1. Grails
  2. GRAILS-8324

Domain object constructor ignored when creating new instance with arguments

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: 2.0-RC2
    • Component/s: Persistence
    • Labels:
      None
    • Environment:
      WIN 7

      Description

      Similar as Sam in GRAILS-7815 I've been using the constructor of my domain objects to set default values for properties.
      While the behaviour of GRAILS-7815 was fixed for new instances without arguments, it continues when using arguments.

      User()

      { role = Role.Diner enabled = true cashBalance = 0 }

      def user = new User()
      assert user.role == Role.Diner

      But with:

      def user = new User(enabled: false)

      the assertion fails, because user.role is null

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Sven Axt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development