aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 51c90a9d9d..3f714397d2 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -235,7 +235,7 @@ module ActiveRecord
# scope :published_and_commented, -> { published.and(self.arel_table[:comments_count].gt(0)) }
# end
def arel_table # :nodoc:
- @arel_table ||= Arel::Table.new(table_name, type_caster: self)
+ @arel_table ||= Arel::Table.new(table_name, type_caster: type_caster)
end
# Returns the Arel engine.
@@ -252,12 +252,6 @@ module ActiveRecord
@predicate_builder ||= PredicateBuilder.new(table_metadata)
end
- def type_cast_for_database(attribute_name, value)
- return value if value.is_a?(Arel::Nodes::BindParam)
- type = type_for_attribute(attribute_name.to_s)
- type.type_cast_for_database(value)
- end
-
private
def relation # :nodoc:
@@ -273,6 +267,10 @@ module ActiveRecord
def table_metadata # :nodoc:
TableMetadata.new(self, arel_table)
end
+
+ def type_caster # :nodoc:
+ TypeCaster::Map.new(self)
+ end
end
# New objects can be instantiated as either empty (pass no construction parameter) or pre-set with