Sha256: 878035bbbd7964f73aecd81dd835bf099c5a69143ff91053c239db478c5edfe1
Contents?: true
Size: 751 Bytes
Versions: 5
Compression:
Stored size: 751 Bytes
Contents
module Ixtlan module Core module ActiveRecord def self.included(base) base.class_eval do def self.optimistic_find(updated_at, *args) if updated_at updated_at_date = new(:updated_at => updated_at).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, updated_at_date - 0.001]) || first(:conditions => ["id = ? and updated_at <= ? and updated_at >= ?", args[0], updated_at_date, updated_at_date - 0.001]) # TODO make it work with different PKs end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems