Sha256: 79d2108c820e8ccd9730b9836d773307f0194d3b62fecdefb7c5d530f163387d

Contents?: true

Size: 778 Bytes

Versions: 21

Compression:

Stored size: 778 Bytes

Contents

require 'virtus'
if Virtus::Attribute::NullifyBlank.method_defined?(:coerce)
  require 'virtus/attribute/nullify_blank'
else
  raise """
  WARNING: The above monkey patch can't be applied as expected.
  See discussion here: https://github.com/dashofcode/tracker_api/commit/27599e7e2169776c32bbff8c972a31b930452879
  """
end
require 'virtus/dirty_attribute'

module TrackerApi
  module Resources
    module Shared
      module Base
        def self.included(base)
          base.class_eval do
            include Virtus.model(nullify_blank: true)
            include Virtus::DirtyAttribute
            include Virtus::DirtyAttribute::InitiallyClean

            include Equalizer.new(:id)

            attribute :id, Integer
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
tracker_api-1.0.0 lib/tracker_api/resources/shared/base.rb