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



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

def self.inherited(base)
  super

  base.transform_types(&:omittable)

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

  base.include Dry::Equalizer(:id)

  base.attribute :id, Types::ID
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?
  id.present?
end