category = Category.new
This isn't persisted to DB yet, so how to distinguish form an object that is saved in the database?
c.persisted? # => true if persisted
c.new_record? # => true if not persisted
:)
c.new_record? # true if new, false if saved
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With