Class: Mongration::Migration

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
lib/mongration/migration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_by_file_name(file_name) ⇒ Object



16
17
18
# File 'lib/mongration/migration.rb', line 16

def self.create_by_file_name(file_name)
  create(file_name: file_name)
end

.destroy_by_file_name(file_name) ⇒ Object



20
21
22
# File 'lib/mongration/migration.rb', line 20

def self.destroy_by_file_name(file_name)
  where(file_name: file_name).first.destroy
end

.file_namesObject



24
25
26
# File 'lib/mongration/migration.rb', line 24

def self.file_names
  Migration.pluck(:file_name)
end

.lastObject



28
29
30
# File 'lib/mongration/migration.rb', line 28

def self.last
  all.to_a.max
end

Instance Method Details

#destroyObject



32
33
34
35
# File 'lib/mongration/migration.rb', line 32

def destroy(*)
  self.deleted_at = Time.now
  save!
end