Module: Ixtlan::OptimisticPersistenceModule
- Defined in:
- lib/ixtlan/optimistic_persistence_module.rb
Instance Method Summary collapse
Instance Method Details
#stale? ⇒ Boolean
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ixtlan/optimistic_persistence_module.rb', line 3 def stale? if(!new? && prop = properties[:updated_at] && dirty?) updated_at = original_attributes[prop] || properties[:updated_at].get!(self) qu = {} c = model.key_conditions(repository, key) c.each {|p,v| qu[p.name] = v} s = self.model.first(qu) if s.nil? false else # use to_s to get it to work in both MRI and JRuby s.updated_at.to_s != updated_at.to_s end else false end end |