Throw when trying to overwrite a template context value. Fixes #1884
This commit is contained in:
parent
09a7d89fd3
commit
7e3baed196
|
@ -36,7 +36,8 @@ module Middleman
|
||||||
@opts = opts
|
@opts = opts
|
||||||
|
|
||||||
@locs.each do |k, _|
|
@locs.each do |k, _|
|
||||||
if self.respond_to?(k)
|
next unless self.respond_to?(k)
|
||||||
|
|
||||||
msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
|
msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
|
||||||
|
|
||||||
if app.build?
|
if app.build?
|
||||||
|
@ -46,7 +47,6 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Return the current buffer to the caller and clear the value internally.
|
# Return the current buffer to the caller and clear the value internally.
|
||||||
# Used when moving between templates when rendering layouts or partials.
|
# Used when moving between templates when rendering layouts or partials.
|
||||||
|
|
Loading…
Reference in a new issue