Class: ActiveRecord::Type::Binary
- Defined in:
- lib/active_record/type/binary.rb
Overview
:nodoc:
Direct Known Subclasses
ConnectionAdapters::PostgreSQL::OID::Bytea, ConnectionAdapters::SQLite3Binary
Defined Under Namespace
Classes: Data
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
- #binary? ⇒ Boolean
- #changed_in_place?(raw_old_value, value) ⇒ Boolean
- #type ⇒ Object
- #type_cast(value) ⇒ Object
- #type_cast_for_database(value) ⇒ Object
Methods inherited from Value
#==, #changed?, #initialize, #klass, #number?, #text?, #type_cast_for_schema, #type_cast_from_database, #type_cast_from_user
Constructor Details
This class inherits a constructor from ActiveRecord::Type::Value
Instance Method Details
#changed_in_place?(raw_old_value, value) ⇒ Boolean
25 26 27 28 |
# File 'lib/active_record/type/binary.rb', line 25 def changed_in_place?(raw_old_value, value) old_value = type_cast_from_database(raw_old_value) old_value != value end |
#type ⇒ Object
4 5 6 |
# File 'lib/active_record/type/binary.rb', line 4 def type :binary end |
#type_cast(value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/active_record/type/binary.rb', line 12 def type_cast(value) if value.is_a?(Data) value.to_s else super end end |