File tree Expand file tree Collapse file tree 2 files changed +3
-16
lines changed
activerecord/lib/active_record Expand file tree Collapse file tree 2 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def associated_table(table_name)
44
44
arel_table = arel_table . alias ( table_name ) if arel_table . name != table_name
45
45
TableMetadata . new ( association_klass , arel_table , reflection )
46
46
else
47
- type_caster = TypeCaster ::Connection . new ( klass , table_name )
47
+ type_caster = TypeCaster ::Connection . new ( klass )
48
48
arel_table = Arel ::Table . new ( table_name , type_caster : type_caster )
49
49
TableMetadata . new ( nil , arel_table , reflection )
50
50
end
Original file line number Diff line number Diff line change 3
3
module ActiveRecord
4
4
module TypeCaster
5
5
class Connection # :nodoc:
6
- def initialize ( klass , table_name )
6
+ def initialize ( klass )
7
7
@klass = klass
8
- @table_name = table_name
9
8
end
10
9
11
10
def type_cast_for_database ( attr_name , value )
@@ -14,20 +13,8 @@ def type_cast_for_database(attr_name, value)
14
13
end
15
14
16
15
def type_for_attribute ( attr_name )
17
- schema_cache = @klass . schema_cache
18
-
19
- if schema_cache . data_source_exists? ( table_name )
20
- column = schema_cache . columns_hash ( table_name ) [ attr_name . to_s ]
21
- if column
22
- type = @klass . lease_connection . lookup_cast_type_from_column ( column )
23
- end
24
- end
25
-
26
- type || Type . default_value
16
+ @klass . type_for_attribute ( attr_name ) || Type . default_value
27
17
end
28
-
29
- private
30
- attr_reader :table_name
31
18
end
32
19
end
33
20
end
You can’t perform that action at this time.
0 commit comments