Fix issue with to_json on data proxies. For #2228
This commit is contained in:
parent
552c486b91
commit
c99b616cf8
|
@ -1,3 +1,4 @@
|
|||
.vscode
|
||||
.byebug_history
|
||||
npm-debug.log
|
||||
manifest.yaml
|
||||
|
|
|
@ -577,3 +577,23 @@ Feature: Incremental builds
|
|||
| build/part-two.html |
|
||||
And the file "build/part-one.html" should contain "Part = 4"
|
||||
And the file "build/part-two.html" should contain "Part = 6"
|
||||
|
||||
Scenario: Wrapped collection methods, like `select`, should effect downstream methods.
|
||||
Given an empty app
|
||||
When a file named "config.rb" with:
|
||||
"""
|
||||
"""
|
||||
When a file named "data/roles.yml" with:
|
||||
"""
|
||||
- title: "Job"
|
||||
salary: 1111
|
||||
"""
|
||||
When a file named "source/roles/data.json.erb" with:
|
||||
"""
|
||||
{
|
||||
"roles": <%= data.roles.select(&:salary).to_json %>
|
||||
}
|
||||
"""
|
||||
Then build the app tracking dependencies
|
||||
Then there are "1" files which are created
|
||||
# with depth "1"
|
|
@ -58,9 +58,9 @@ module Middleman
|
|||
@data.to_s
|
||||
end
|
||||
|
||||
def to_json
|
||||
def to_json(*args)
|
||||
log_access(:__full_access__)
|
||||
@data.to_a.to_json
|
||||
@data.to_a.to_json(*args)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -27,9 +27,9 @@ module Middleman
|
|||
@data.to_s
|
||||
end
|
||||
|
||||
def to_json
|
||||
def to_json(*args)
|
||||
log_access(:__full_access__)
|
||||
@data.to_h.to_json
|
||||
@data.to_h.to_json(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue