Skip to content

Commit

Permalink
Support limit(n) and offset(n) nodes in dot output
Browse files Browse the repository at this point in the history
  • Loading branch information
kamipo committed May 1, 2020
1 parent ff1b97a commit 7669dc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/arel/visitors/dot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def visit_Arel_Nodes_BindParam(o)
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

Expand Down
7 changes: 7 additions & 0 deletions activerecord/test/cases/arel/visitors/dot_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative "../helper"
require "active_model/attribute"

module Arel
module Visitors
Expand Down Expand Up @@ -78,6 +79,12 @@ def test_Arel_Nodes_BindParam
collector = Collectors::PlainString.new
assert_match '[label="<f0>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="<f0>ActiveModel::Attribute::WithCastValue"]', @visitor.accept(node, collector).value
end
end
end
end

0 comments on commit 7669dc2

Please sign in to comment.