Closed nzifnab closed 11 years ago
Not really sure what may be the issue here as I am not familiar with draper. Could you check to see what type @products
is? Does draper wrap the collection with a single ProductDecorator
object or is each element a ProductDecorator
object?
When array
is called, internally json_builder just calls .each
on it and passes in each element to the block, see here.
Could you possibly setup an example app (or single .rb file) that reproduces this?
Closing due to no response, please re-open when you can get me a few pieces of info as above.
Not sure where the culprit is but I'm going to post this here and hope we can figure out what the issue is :)
I'm using
json_builder
in a rails project. Simple enough.My controller:
And my index view:
Yes, this example is very basic. I'm just trying to display the issue. I'm using the
draper
gem to decorate myproducts
collection: https://github.com/drapergem/draper@products
is correctly aProductDecorator
. So is@products[0]
. However, in that view inside the blockproduct
is just aProduct
and is no longer decorated. Any idea why that might be?