Class: ApplicationModel

Inherits:
ROM::Struct
  • Object
show all
Defined in:
lib/generators/rom/install/templates/application_model.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inherited(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/rom/install/templates/application_model.rb', line 5

def self.inherited(base)
  super

  base.transform_types(&:omittable)

  base.extend ActiveModel::Naming
  base.include ActiveModel::Conversion

  base.include Dry::Core::Equalizer.new(:id)

  base.attribute :id, Types::ID
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/generators/rom/install/templates/application_model.rb', line 18

def persisted?
  id.present?
end