method

serialize

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Interval
serialize(value) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb, line 29
          def serialize(value)
            case value
            when ::ActiveSupport::Duration
              value.iso8601(precision: self.precision)
            when ::Numeric
              # Sometimes operations on Times returns just float number of seconds so we need to handle that.
              # Example: Time.current - (Time.current + 1.hour) # => -3600.000001776 (Float)
              value.seconds.iso8601(precision: self.precision)
            else
              super
            end
          end
Register or log in to add new notes.