activerecord-safer_migrations
activerecord-safer_migrations copied to clipboard
Handle disabling timeouts in indirect ActiveRecord::Migration subclasses
Attempts to disable timeouts in non-direct subclasses of ActiveRecord::Migration
fail in Rails 4.x with the following exception:
NoMethodError:
undefined method `say' for nil:NilClass
# /Users/jturkel/.rvm/gems/ruby-2.3.4@activerecord-safer_migrations/gems/activerecord-4.2.9/lib/active_record/migration.rb:416:in `method_missing'
# ./lib/active_record/safer_migrations/migration.rb:43:in `disable_lock_timeout!'
This was fixed in Rails 5.0 with https://github.com/rails/rails/commit/f37d92c41036d4eff168b8a8951a8b8a76baa347. This PR works around the issue in Rails 4.x by explicitly defining the ActiveRecord::Migration.say
method which avoids the Rails bug in ActiveRecord::Migration.method_missing
. The implementation of say
was copied directly from Rails (with some rubocop fixes applied).