Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bd2f5c062d
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (35 sloc) 0.946 kb
module ActiveRecord
class Base
def self.fake_connection(config)
ConnectionAdapters::FakeAdapter.new nil, logger
end
end
module ConnectionAdapters
class FakeAdapter < AbstractAdapter
attr_accessor :tables, :primary_keys
@columns = Hash.new { |h,k| h[k] = [] }
class << self
attr_reader :columns
end
def initialize(connection, logger)
super
@tables = []
@primary_keys = {}
@columns = self.class.columns
end
def primary_key(table)
@primary_keys[table]
end
def merge_column(table_name, name, sql_type = nil, options = {})
@columns[table_name] << ActiveRecord::ConnectionAdapters::Column.new(
name.to_s,
options[:default],
sql_type.to_s,
options[:null])
end
def columns(table_name, message)
@columns[table_name]
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.