Module: DeletedAt

Defined in:
lib/deleted_at/table_definition.rb,
lib/deleted_at.rb,
lib/deleted_at/core.rb,
lib/deleted_at/legacy.rb,
lib/deleted_at/railtie.rb,
lib/deleted_at/version.rb,
lib/deleted_at/relation.rb,
lib/deleted_at/active_record.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ActiveRecord, Core, Legacy, Relation, TableDefinition Classes: Railtie

Constant Summary collapse

MissingColumn =
Class.new(StandardError)
DEFAULT_OPTIONS =
{
  column: :deleted_at,
  proc: -> { Time.now.utc }
}
VERSION =
"0.5.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.disabledObject (readonly)

Returns the value of attribute disabled.



15
16
17
# File 'lib/deleted_at.rb', line 15

def disabled
  @disabled
end

.loggerObject



17
18
19
20
21
22
# File 'lib/deleted_at.rb', line 17

def logger
  @logger ||= Logger.new($stdout).tap do |log|
    log.progname = self.name
    log.level = Logger::INFO
  end
end

Class Method Details

.disableObject



31
32
33
# File 'lib/deleted_at.rb', line 31

def self.disable
  @disabled = true
end

.disabled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/deleted_at.rb', line 27

def self.disabled?
  @disabled == true
end

.enableObject



35
36
37
# File 'lib/deleted_at.rb', line 35

def self.enable
  @disabled = false
end

.gemspecObject



39
40
41
# File 'lib/deleted_at.rb', line 39

def self.gemspec
  @gemspec ||= eval(`gem spec deleted_at --ruby`).freeze
end

.install(model) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/deleted_at.rb', line 43

def self.install(model)
  logger.warn <<-STR
  Great news! You're using the new and improved version of DeletedAt. No more table renaming.
  You'll want to migrate your old models to use the new (non-view based) functionality.
  Follow the instructions at #{gemspec.homepage}.
  STR
end

.uninstall(model) ⇒ Object



51
52
53
# File 'lib/deleted_at.rb', line 51

def self.uninstall(model)

end