module Clerk

Constants

VERSION

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/clerk/configuration.rb, line 8
def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

Public Instance Methods

track_who_does_it(options = {}) click to toggle source
# File lib/clerk.rb, line 9
def track_who_does_it(options = {})
  before_create Clerk::Callback.new
  before_update Clerk::Callback.new

  creator_fk = options.fetch(:creator_foreign_key) { "created_by_id" }
  updater_fk = options.fetch(:updater_foreign_key) { "updated_by_id" }

  belongs_to :creator, :class_name => "User", :foreign_key => creator_fk, :optional => true
  belongs_to :updater, :class_name => "User", :foreign_key => updater_fk, :optional => true
end