ActiveRecord new_record?
ActiveRecord の new_record?
まだ save されていない record だったら true を返す。
違っていれば false。
厳密には、一つのレコードに対するオブジェクトが ストア(保存) されていなければ true
違えば false
別件だけど、読みやすい英語コメントだった。見習いたい。
# Returns true if this object hasn't been saved yet -- that is, a record # for the object doesn't exist in the data store yet; otherwise, returns false. def new_record? sync_with_transaction_state @new_record end