Skip to content

Commit 3fbe3e2

Browse files
committed
add documentation to upgrade guide
1 parent 3080e96 commit 3fbe3e2

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

grails-doc/src/en/guide/upgrading/upgrading60x.adoc

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,4 +1238,52 @@ The admin controller will use the admin-specific template even if a non-namespac
12381238

12391239
====== Backward Compatibility
12401240

1241-
This feature is **disabled by default** (`false`), ensuring complete backward compatibility. Existing applications will continue to work without any changes. Enable the feature only when you need namespace-specific scaffolded template support.
1241+
This feature is **disabled by default** (`false`), ensuring complete backward compatibility. Existing applications will continue to work without any changes. Enable the feature only when you need namespace-specific scaffolded template support.
1242+
1243+
===== 12.31 Enhanced Display Constraint with DisplayType Enum
1244+
1245+
Grails 7.1 enhances the `display` constraint with a new `DisplayType` enum that provides fine-grained control over where properties appear in scaffolded views.
1246+
1247+
====== New DisplayType Values
1248+
1249+
The `display` constraint now accepts a `DisplayType` enum value in addition to boolean values:
1250+
1251+
|===
1252+
|Value|Description
1253+
1254+
|`ALL`|Display in all views. Overrides the default blacklist for properties like `dateCreated` and `lastUpdated`.
1255+
|`NONE`|Never display in any view. Equivalent to `display: false`.
1256+
|`INPUT_ONLY`|Display only in input views (create and edit forms).
1257+
|`OUTPUT_ONLY`|Display only in output views (show and index/list views).
1258+
|===
1259+
1260+
====== Example Usage
1261+
1262+
[source,groovy]
1263+
----
1264+
import static grails.gorm.validation.DisplayType.*
1265+
1266+
class Book {
1267+
String title
1268+
String isbn
1269+
Date dateCreated
1270+
Date lastUpdated
1271+
String internalNotes
1272+
1273+
static constraints = {
1274+
dateCreated display: ALL // Override blacklist, show in all views
1275+
lastUpdated display: OUTPUT_ONLY // Show only in show/index views
1276+
isbn display: INPUT_ONLY // Show only in create/edit forms
1277+
internalNotes display: NONE // Never show
1278+
}
1279+
}
1280+
----
1281+
1282+
====== Backward Compatibility
1283+
1284+
Boolean values continue to work as before:
1285+
1286+
* `display: true` - Default behavior (property is displayed)
1287+
* `display: false` - Equivalent to `DisplayType.NONE`
1288+
1289+
No changes are required for existing applications using boolean values.

0 commit comments

Comments
 (0)