Sha256: a14a7aed6b4d040f2b663b1b06b2152d71171de616f2ddc044ffbba36b5eb366

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

require 'eac_rails_utils/patches/active_model_associations'
require 'virtus'

module EacRailsUtils
  module Models
    class Tableless
      include ActiveModel::Model
      include Virtus.model
      include ActiveModel::Associations

      def initialize(values = {})
        super(build_attributes(values))
      end

      def save!
        save || raise("#{self.class}.save failed: #{errors.messages}")
      end

      require_sub __FILE__, require_mode: :kernel, include_modules: :include
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eac_rails_utils-0.20.0 lib/eac_rails_utils/models/tableless.rb