Module: GoodTouch::InstanceMethods

Defined in:
lib/good_touch.rb

Instance Method Summary collapse

Instance Method Details

#good_touch(*args) ⇒ Object

touch a record without triggering callbacks update DB directly to avoid overhead of reindexing the user



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/good_touch.rb', line 7

def good_touch(*args)
  value=args.pop unless args.empty?
  if value.kind_of? Symbol
    args << value
    value=Time.now.utc
  end
  args << :updated_at if args.empty?
  updates={}
  args.each { |arg| updates[arg]=value }
  self.class.update_all(updates, {:id => self.id})
end