Mistaken duplicate JSON nested object - Rails -
i have rails api returns json using rabl gem. here's /show
template extended /index
template well.
object @deal attributes :headline, :text, :image, :id, :created_at child :vendor attributes :image_url, :id end
both deal
, vendor
have images, uploaded through carrierwave/fog s3. problem i'm seeing here returned json includes , image
object deal
. so:
"deal":{"image":{"image":{"url":"httpxxxxxxxxxxxx"}}}
in contrast, json vendor returns appropriately:
"vendor":{"image_url":"httpxxxxxxxxxxx"}
my uploaders below:
class dealuploader < carrierwave::uploader::base def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end # vendor image uploader class imageuploader < carrierwave::uploader::base def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end
why getting redundant image
object?
try
object @deal attributes :headline, :text, :image_url, :id, :created_at child :vendor attributes :image_url, :id end
Comments
Post a Comment