Sha256: adbfed05fbf01ef391d4a103bb5ab08a0ff5da2b01eff59f3d40feb3520493d4

Contents?: true

Size: 331 Bytes

Versions: 3

Compression:

Stored size: 331 Bytes

Contents

require "types"

class ApplicationModel < ROM::Struct
  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

  def persisted?
    id.present?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-rails-2.3.1 lib/generators/rom/install/templates/application_model.rb
rom-rails-2.3.0 lib/generators/rom/install/templates/application_model.rb
rom-rails-2.2.0 lib/generators/rom/install/templates/application_model.rb