Class: UserStampSweeper

Inherits:
ActionController::Caching::Sweeper
  • Object
show all
Defined in:
lib/user_stamp.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) before_validation(record)



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/user_stamp.rb', line 30

def before_validation(record)
  return unless current_user
  
  if record.respond_to?(UserStamp.creator_assignment_method) && record.new_record?
    record.send(UserStamp.creator_assignment_method, current_user.id)
  end
  
  if record.respond_to?(UserStamp.updater_assignment_method)
    record.send(UserStamp.updater_assignment_method, current_user.id)
  end
end