Class: RailsAsyncMigrations::Mutators::Base
- Inherits:
-
Object
- Object
- RailsAsyncMigrations::Mutators::Base
show all
- Defined in:
- lib/rails_async_migrations/mutators/base.rb
Instance Method Summary
collapse
Instance Method Details
#current_migration ⇒ Object
19
20
21
|
# File 'lib/rails_async_migrations/mutators/base.rb', line 19
def current_migration
@current_migration ||= Connection::ActiveRecord.new(:up).current_migration
end
|
#fetch_from_file ⇒ Object
14
15
16
17
|
# File 'lib/rails_async_migrations/mutators/base.rb', line 14
def fetch_from_file
require current_migration.filename
current_migration.name.constantize
end
|
#migration_class ⇒ Object
in some context we have to guess it from the file and current connection for instance when we use class methods such as turn_async
6
7
8
9
10
11
12
|
# File 'lib/rails_async_migrations/mutators/base.rb', line 6
def migration_class
if instance.class == ActiveRecord::Migration
fetch_from_file
else
instance.class
end
end
|