method

new

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: QueryAttribute
new(...) 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/relation/query_attribute.rb, line 8
      def initialize(...)
        super

        # The query attribute value may be mutated before we actually "compile" the query.
        # To avoid that if the type uses a serializer we eagerly compute the value for database
        if value_before_type_cast.is_a?(StatementCache::Substitute)
          # we don't need to serialize StatementCache::Substitute
        elsif @type.serialized?
          value_for_database
        elsif @type.mutable? # If the type is simply mutable, we deep_dup it.
          @value_before_type_cast = @value_before_type_cast.deep_dup
        end
      end
Register or log in to add new notes.