Class: ActiveRecord::TypeCaster::Connection
- Inherits:
-
Object
- Object
- ActiveRecord::TypeCaster::Connection
- Defined in:
- lib/active_record/type_caster/connection.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(klass, table_name) ⇒ Connection
constructor
A new instance of Connection.
- #type_cast_for_database(attribute_name, value) ⇒ Object
Constructor Details
#initialize(klass, table_name) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 |
# File 'lib/active_record/type_caster/connection.rb', line 6 def initialize(klass, table_name) @klass = klass @table_name = table_name end |
Instance Method Details
#type_cast_for_database(attribute_name, value) ⇒ Object
11 12 13 14 15 |
# File 'lib/active_record/type_caster/connection.rb', line 11 def type_cast_for_database(attribute_name, value) return value if value.is_a?(Arel::Nodes::BindParam) column = column_for(attribute_name) connection.type_cast_from_column(column, value) end |