blob: 847fd4dded592dff1eb68452b1fc08aeea3e672c (
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
|
require 'active_record/connection_adapters/postgresql/cast'
module ActiveRecord
module ConnectionAdapters
# PostgreSQL-specific extensions to column definitions in a table.
class PostgreSQLColumn < Column #:nodoc:
extend PostgreSQL::Cast
attr_accessor :array
def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil)
if sql_type =~ /\[\]$/
@array = true
super(name, default, cast_type, sql_type[0..sql_type.length - 3], null)
else
@array = false
super(name, default, cast_type, sql_type, null)
end
@default_function = default_function
end
end
end
end
|