lib/track_changes/configuration.rb in track_changes-0.5.1 vs lib/track_changes/configuration.rb in track_changes-1.0.0.pre1

- old
+ new

@@ -1,38 +1,9 @@ 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 + # If a constant DEFAULT_USER_FINDER is defined in this class. Call it. + def self.get_default_user + defined?(DEFAULT_USER_FINDER) && DEFAULT_USER_FINDER.call end end end