Module: UseDb::Migration::ClassMethods

Defined in:
lib/use_db/migration.rb

Instance Method Summary collapse

Instance Method Details

#method_missing_with_connection_swap(method, *arguments, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/use_db/migration.rb', line 16

def method_missing_with_connection_swap(method, *arguments, &block)
	say_with_time "#{method}(#{arguments.map { |a| a.inspect }.join(", ")})" do
		arguments[0] = ActiveRecord::Migrator.proper_table_name(arguments.first
			) unless arguments.empty? || method == :execute
		if (self.respond_to?(:database_model))
			write "Using custom database model's connection (#{self.database_model}) for this migration"
			eval("#{self.database_model}.connection.send(method, *arguments, &block)")
		else
			ActiveRecord::Base.connection.send(method, *arguments, &block)
#					method_missing_without_connection_swap(method, *arguments, &block)
		end
	end
end

#uses_db?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/use_db/migration.rb', line 30

def uses_db?
	true
end