(快速参考)

isDirty

用途

检查某个领域类实例是否已被修改。

示例

def b = Book.get(1)
someMethodThatMightModifyTheInstance(b)

// when called without arguments returns true if any field was changed
if (b.isDirty()) {
    // can also check if one field has changed
    if (b.isDirty('title')) {
        ...
    }
}

说明

参数

  • fieldName - 要检查的字段名称