mirror of https://github.com/rails/rails
Allow tag values to be static
This commit is contained in:
parent
1e3e1a0e72
commit
16242464db
|
@ -154,7 +154,7 @@ module ActiveRecord
|
|||
tags.flat_map { |i| [*i] }.filter_map do |tag|
|
||||
key, value_input = tag
|
||||
val = case value_input
|
||||
when nil then instance_exec(&taggings[key]) if taggings.has_key? key
|
||||
when nil then tag_value(key) if taggings.has_key? key
|
||||
when Proc then instance_exec(&value_input)
|
||||
else value_input
|
||||
end
|
||||
|
@ -162,6 +162,16 @@ module ActiveRecord
|
|||
end.join(",")
|
||||
end
|
||||
|
||||
def tag_value(key)
|
||||
value = taggings[key]
|
||||
|
||||
if value.respond_to?(:call)
|
||||
instance_exec(&taggings[key])
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
def inline_tag_content
|
||||
inline_tags.join
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue