Skip to content

Commit 1624246

Browse files
committed
Allow tag values to be static
1 parent 1e3e1a0 commit 1624246

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

activerecord/lib/active_record/query_logs.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,24 @@ def tag_content
154154
tags.flat_map { |i| [*i] }.filter_map do |tag|
155155
key, value_input = tag
156156
val = case value_input
157-
when nil then instance_exec(&taggings[key]) if taggings.has_key? key
157+
when nil then tag_value(key) if taggings.has_key? key
158158
when Proc then instance_exec(&value_input)
159159
else value_input
160160
end
161161
"#{key}:#{val}" unless val.nil?
162162
end.join(",")
163163
end
164164

165+
def tag_value(key)
166+
value = taggings[key]
167+
168+
if value.respond_to?(:call)
169+
instance_exec(&taggings[key])
170+
else
171+
value
172+
end
173+
end
174+
165175
def inline_tag_content
166176
inline_tags.join
167177
end

0 commit comments

Comments
 (0)