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.
4 5 6 7 |
# File 'lib/active_record/type_caster/connection.rb', line 4 def initialize(klass, table_name) @klass = klass @table_name = table_name end |
Instance Method Details
#type_cast_for_database(attribute_name, value) ⇒ Object
9 10 11 12 13 |
# File 'lib/active_record/type_caster/connection.rb', line 9 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 |