Class: Mongration::Migration
- Inherits:
-
Object
- Object
- Mongration::Migration
- Includes:
- Mongoid::Document
- Defined in:
- lib/mongration/migration.rb
Class Method Summary collapse
- .create_by_file_name(file_name) ⇒ Object
- .destroy_by_file_name(file_name) ⇒ Object
- .file_names ⇒ Object
- .last ⇒ Object
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_names ⇒ Object
24 25 26 |
# File 'lib/mongration/migration.rb', line 24 def self.file_names Migration.pluck(:file_name) end |
.last ⇒ Object
28 29 30 |
# File 'lib/mongration/migration.rb', line 28 def self.last all.to_a.max end |
Instance Method Details
#destroy ⇒ Object
32 33 34 35 |
# File 'lib/mongration/migration.rb', line 32 def destroy(*) self.deleted_at = Time.now save! end |