blob: c28e9b1a0bc5f1b0f314bc65efa8b8a77cb6b73f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
module Fake
class Engine
def connection
@conn ||= Connection.new
end
end
class Connection
include ActiveRecord::ConnectionAdapters::Quoting
def columns(table_name, comment)
{ "users" =>
[
Column.new("id", :integer),
Column.new("name", :string)
],
"photos" =>
[
Column.new("id", :integer),
Column.new("user_id", :integer),
Column.new("camera_id", :integer)
]
}[table_name]
end
def execute(*args)
[]
end
def quote_column_name(column_name)
"`#{column_name}`"
end
def quote_table_name(table_name)
"`#{table_name}`"
end
end
class Column
attr_reader :name, :type
def initialize(name, type)
@name = name
@type = type
end
end
end
|