(快速參考)

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 - 要檢查的欄位名稱