module Scm_devise

Constants

VERSION

Attributes

configuration[RW]

Public Class Methods

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

Public Instance Methods

track_who_does_it(options = {}, current_employee) click to toggle source
# File lib/scm_devise.rb, line 8
def track_who_does_it(options = {}, current_employee)
  before_create Scm_devise::Callback.new
  before_update Scm_devise::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 => "Employee", :foreign_key => creator_fk
  belongs_to :updater, :class_name => "Employee", :foreign_key => updater_fk
end