method

new

rails latest stable - Class: ActiveRecord::Relation::QueryAttribute
new(...)
public

No documentation available.

# 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