Class: PaperTrail::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/paper_trail/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/paper_trail/config.rb', line 10

def initialize
  @enabled         = true # Indicates whether PaperTrail is on or off.
  @timestamp_field = :created_at
  @serializer      = PaperTrail::Serializers::YAML

  # This setting only defaults to false on AR 4.2+, because that's when
  # it was deprecated. We want it to function with older versions of
  # ActiveRecord by default.
  if ::ActiveRecord::VERSION::STRING < '4.2'
    @serialized_attributes = true
  end
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled



6
7
8
# File 'lib/paper_trail/config.rb', line 6

def enabled
  @enabled
end

#serialized_attributesObject

Returns the value of attribute serialized_attributes



7
8
9
# File 'lib/paper_trail/config.rb', line 7

def serialized_attributes
  @serialized_attributes
end

#serializerObject

Returns the value of attribute serializer



6
7
8
# File 'lib/paper_trail/config.rb', line 6

def serializer
  @serializer
end

#timestamp_fieldObject

Returns the value of attribute timestamp_field



6
7
8
# File 'lib/paper_trail/config.rb', line 6

def timestamp_field
  @timestamp_field
end

#track_associationsObject Also known as: track_associations?



32
33
34
# File 'lib/paper_trail/config.rb', line 32

def track_associations
  @track_associations ||= PaperTrail::VersionAssociation.table_exists?
end

#version_limitObject

Returns the value of attribute version_limit



6
7
8
# File 'lib/paper_trail/config.rb', line 6

def version_limit
  @version_limit
end