Sha256: 2aa0c9247fb5275ca15c53299ab5d69639e6fcf222a629e3259d66ab43b29ac2
Contents?: true
Size: 389 Bytes
Versions: 3
Compression:
Stored size: 389 Bytes
Contents
# encoding: utf-8 require "mongoid/errors/missing_field" module Mongoid module Document def touch( at_field = nil ) to_touch = at_field || :updated_at if self.fields.include? to_touch.to_s self.update_attribute(to_touch.to_sym, Time.now.utc) else raise Errors::MissingField.new(to_touch.to_s) end end alias :touch! :touch end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid_touch-0.0.4 | lib/mongoid_touch.rb |
mongoid_touch-0.0.3 | lib/mongoid_touch.rb |
mongoid_touch-0.0.2 | lib/mongoid_touch.rb |