From 6160bfbda1d1781c3b08a33ec4955f170e95be11 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 29 Dec 2014 11:24:44 -0700 Subject: Allow a type caster to be given to the `Arel::Table` object This will allow most consuming code to avoid the deprecation introduced in 008445d6fd5f825d9b445ac75a7be67f0f7ab52c. The only code which will be affected is code that is building the `Arel::Table` object manually, rather than calling `arel_table` on an Active Record class. Hopefully this case will be rare enough that we don't need to introduce any additional APIs to work around it. --- lib/arel/nodes/table_alias.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/arel/nodes') diff --git a/lib/arel/nodes/table_alias.rb b/lib/arel/nodes/table_alias.rb index b32f057117..a5adc0766a 100644 --- a/lib/arel/nodes/table_alias.rb +++ b/lib/arel/nodes/table_alias.rb @@ -12,6 +12,14 @@ module Arel def table_name relation.respond_to?(:name) ? relation.name : name end + + def type_cast_for_database(*args) + relation.type_cast_for_database(*args) + end + + def able_to_type_cast? + relation.respond_to?(:able_to_type_cast?) && relation.able_to_type_cast? + end end end end -- cgit v1.2.3