Module: MysqlOnlineMigrations
- Defined in:
- lib/mysql_online_migrations.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
10 11 12 13 |
# File 'lib/mysql_online_migrations.rb', line 10 def self.prepended(base) ActiveRecord::Base.send(:class_attribute, :mysql_online_migrations, :instance_writer => false) ActiveRecord::Base.send("mysql_online_migrations=", true) end |
Instance Method Details
#connection ⇒ Object
15 16 17 |
# File 'lib/mysql_online_migrations.rb', line 15 def connection @no_lock_adapter ||= ActiveRecord::ConnectionAdapters::Mysql2AdapterWithoutLock.new(super) end |
#with_lock ⇒ Object
19 20 21 22 23 24 |
# File 'lib/mysql_online_migrations.rb', line 19 def with_lock original_value = ActiveRecord::Base.mysql_online_migrations ActiveRecord::Base.mysql_online_migrations = false yield ActiveRecord::Base.mysql_online_migrations = original_value end |