class Clerk::Callback

Public Instance Methods

before_create(record) click to toggle source
# File lib/clerk/callback.rb, line 3
def before_create(record)
  record.creator = current_user if record.respond_to?(:creator) && current_user
  record.updater = current_user if record.respond_to?(:updater) && current_user
end
before_update(record) click to toggle source
# File lib/clerk/callback.rb, line 8
def before_update(record)
  record.updater = current_user if record.respond_to?(:updater) && current_user
end
current_user() click to toggle source

relies on `include SentientUser` on User

# File lib/clerk/callback.rb, line 13
def current_user
  warn "User#current is not defined, are you including SentientUser on your User model?" unless User.respond_to?(:current)
  warn "User#current is nil, are you including SentientController on your ApplicationController?" unless User.current

  User.current
end

Private Instance Methods

configuration() click to toggle source
# File lib/clerk/callback.rb, line 32
def configuration
  Clerk.configuration
end
logger() click to toggle source
# File lib/clerk/callback.rb, line 28
def logger
  configuration.logger
end
warn(message) click to toggle source
# File lib/clerk/callback.rb, line 24
def warn(message)
  logger.warn "WARNING: #{message}" unless configuration.silence_warnings
end