Sha256: ec365996dfbd6076a27a966cb40e4a1278e5905eace28d785e1c119f8746eeea

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

module Ixtlan
  module Core
    module ActiveRecord

      def self.included(base)
        warn 'deprecated: use ixtlan-optimistic instead'
        base.class_eval do

          def self.optimistic_find(updated_at, *args)
            if updated_at  
              dummy = self.new
              dummy.updated_at = updated_at
              updated_at_date = dummy.updated_at
              # try different ways to use the date
              # TODO maybe there is a nicer way ??
              first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at_date + 0.0005, updated_at_date - 0.0005])
              # TODO make it work with different PKs
            end
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ixtlan-core-0.7.5 lib/ixtlan/core/active_record.rb