Class: ActiveRecord::Type::String
- Defined in:
- lib/active_record/type/string.rb
Overview
:nodoc:
Direct Known Subclasses
ConnectionAdapters::AbstractMysqlAdapter::MysqlString, ConnectionAdapters::PostgreSQL::OID::SpecializedString, ConnectionAdapters::PostgreSQL::OID::Xml, Text
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
- #changed_in_place?(raw_old_value, new_value) ⇒ Boolean
- #text? ⇒ Boolean
- #type ⇒ Object
- #type_cast_for_database(value) ⇒ Object
Methods inherited from Value
#==, #binary?, #changed?, #initialize, #klass, #number?, #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, new_value) ⇒ Boolean
8 9 10 11 12 |
# File 'lib/active_record/type/string.rb', line 8 def changed_in_place?(raw_old_value, new_value) if new_value.is_a?(::String) raw_old_value != new_value end end |
#type ⇒ Object
4 5 6 |
# File 'lib/active_record/type/string.rb', line 4 def type :string end |
#type_cast_for_database(value) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/active_record/type/string.rb', line 14 def type_cast_for_database(value) case value when ::Numeric, ActiveSupport::Duration then value.to_s when ::String then ::String.new(value) when true then "t" when false then "f" else super end end |