Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails Scaffolding Update Constraint UI Bug #11280

Closed
pleonar3 opened this issue Mar 22, 2019 · 3 comments
Closed

Grails Scaffolding Update Constraint UI Bug #11280

pleonar3 opened this issue Mar 22, 2019 · 3 comments
Assignees

Comments

@pleonar3
Copy link

Steps to Reproduce

  1. Create a grails app, or clone the repo.
  2. Create a domain class with a unique constraint property.
  3. Create two objects with different property values. Now, update one of the objects to have the same value as the other. Observe what happens when the object is persisted.

Expected Behaviour

You should receive the standard grails property constraint error message when the web response is received.

Actual Behaviour

The update errors silently. The property is flipped back to its original value, the user is not notified of the error at all.

Environment Information

  • Operating System: Ubuntu 18
  • Grails Version: 3.3.8
  • JDK Version: openjdk version "1.8.0_172"

Example Application

@pleonar3 pleonar3 changed the title Grails Scaffolding Update Constraint Bug Grails Scaffolding Update Constraint UI Bug Mar 22, 2019
@niravassar niravassar self-assigned this Apr 5, 2019
@niravassar
Copy link

niravassar commented Apr 9, 2019

i did the exact same thing in 3.2.13 and we got the correct response in the error message. This means somewhere in between it broke. i will look further

CORRECTION

The above is false. if you create a new object and try and save a value that should be unique, then you do get the correct message Property [shouldBeUnique] of class [class headaches.three.two.ConstraintUpdateHeadache] with value [xxxx] must be unique. However, if you edit an existing object and assign it the unique value again it will fail silently and not take the value, just as the ticket explains.

@niravassar
Copy link

niravassar commented Apr 10, 2019

WORKAROUND

In the sample project, if you delete ConstraintUpdateHeadacheController, then run grails generate-all app.ConstraintUpdateHeadacheController, it will generate the Controller code and also the gsp pages, along with a DataService interface. Run the steps again to create two objects with different values and save them. Then again change one object to the unique value. This will generate the correct message. Use this as a workaround.

The issues seems to be with the runtime generation of the gsps of the scaffold. I have tested this with service methods and when a unique value is saved, the error is generated properly in the domain object. When I render the errors back manually to the screen it will appropriately display the unique property error generated by the Gorm exception.

We will look to see what the error is in the scaffold code.

@niravassar
Copy link

This issue is not a pressing issue, although it is a bug. I recommend we go with the workaround. I'll keep this issue open if someone wants to look into it further. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants