diff --git a/activerecord/lib/arel/visitors/dot.rb b/activerecord/lib/arel/visitors/dot.rb index 25cd564fcc..4a4da66f38 100644 --- a/activerecord/lib/arel/visitors/dot.rb +++ b/activerecord/lib/arel/visitors/dot.rb @@ -222,7 +222,7 @@ module Arel # :nodoc: all edge("value") { visit o.value } end - def visit_ActiveRecord_Relation_QueryAttribute(o) + def visit_ActiveModel_Attribute(o) edge("value_before_type_cast") { visit o.value_before_type_cast } end diff --git a/activerecord/test/cases/arel/visitors/dot_test.rb b/activerecord/test/cases/arel/visitors/dot_test.rb index ade53c358e..be9f176be9 100644 --- a/activerecord/test/cases/arel/visitors/dot_test.rb +++ b/activerecord/test/cases/arel/visitors/dot_test.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "../helper" +require "active_model/attribute" module Arel module Visitors @@ -78,6 +79,12 @@ module Arel collector = Collectors::PlainString.new assert_match '[label="Arel::Nodes::BindParam"]', @visitor.accept(node, collector).value end + + def test_ActiveModel_Attribute + node = ActiveModel::Attribute.with_cast_value("LIMIT", 1, nil) + collector = Collectors::PlainString.new + assert_match '[label="ActiveModel::Attribute::WithCastValue"]', @visitor.accept(node, collector).value + end end end end