Support `limit(n)` and `offset(n)` nodes in dot output

This commit is contained in:
Ryuta Kamizono 2020-05-02 07:12:25 +09:00
parent ff1b97ac09
commit 7669dc2196
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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="<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