Sha256: 0c010b8ed557e6087d0110e7fadddbfeb19daedd39206cb156c054aa59f01de9

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

module TrackChanges
  class Configuration
    # The association used to create an audit. Defaults to
    # <tt>:audits</tt>
    #
    # Example:
    #   :audits  # => Call model.audits.create
    #   :changes # => Call model.changes.create
    attr_accessor :audit_association

    # The controller method called to obtain the current user.
    # Defaults to <tt>:current_user</tt>
    attr_accessor :current_user

    # Ignore if the audited item is nil. Defaults to <tt>true</tt>.
    attr_accessor :ignore_nil

    def initialize
      self.audit_association = default_audit_association
      self.current_user      = default_current_user
      self.ignore_nil        = default_ignore_nil
    end

    private

    def default_audit_association
      :audits
    end

    def default_current_user
      :current_user
    end

    def default_ignore_nil
      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
track_changes-0.5.1 lib/track_changes/configuration.rb