我如何反思一个ActiveRecord对象,以确定其是否新的或产生的?
How can I introspect an ActiveRecord object to determine whether its new or created?
问对象,如果它是一个新的记录
ask the object if it's a new record
object.new_record?
http://apidock.com/rails/ActiveRecord/Persistence/new_record%3F