Sha256: 3b7d85df38806ac28e3a1c353906bde449734a9326b836c70b00cedd38e8ba0f

Contents?: true

Size: 478 Bytes

Versions: 5

Compression:

Stored size: 478 Bytes

Contents

module Ardm
  module Ar
    module Dirty
      def dirty?
        changed?
      end

      def dirty_attributes
        changes.inject({}) do |memo, (attr, val)|
          property = properties[attr]
          memo[property] = val
          memo
        end
      end

      def method_missing(meth, *args, &block)
        if meth.to_s =~ /^([\w_]+)_dirty\?$/
          send("#{$1}_changed?", *args, &block)
        else
          super
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 lib/ardm/ar/dirty.rb
ardm-0.4.0 lib/ardm/ar/dirty.rb
ardm-0.3.2 lib/ardm/ar/dirty.rb
ardm-0.3.1 lib/ardm/ar/dirty.rb
ardm-0.3.0 lib/ardm/ar/dirty.rb