instance method persisted?

Ruby on Rails 7.0.10

Since v7.0.10

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

persisted?()

Indicates if the model is persisted. Default is false.

class Person
  include ActiveModel::API
  attr_accessor :id, :name
end

person = Person.new(id: 1, name: 'bob')
person.persisted? # => false
Source
# File activemodel/lib/active_model/api.rb, line 95
    def persisted?
      false
    end

Defined in activemodel/lib/active_model/api.rb line 95 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveModel::API

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close