Sha256: 1a14fc6d957f954e55c15f8350340baeff8c6ccd5d4fe6a7374c5112e722ba35

Contents?: true

Size: 327 Bytes

Versions: 3

Compression:

Stored size: 327 Bytes

Contents

require 'types'

class ApplicationModel < ROM::Struct
  def self.inherited(base)
    super

    base.constructor_type :schema

    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-1.2.0 lib/generators/rom/install/templates/application_model.rb
rom-rails-1.1.1 lib/generators/rom/install/templates/application_model.rb
rom-rails-1.1.0 lib/generators/rom/install/templates/application_model.rb