2
我使用Rabl的宝石,我的用户模型有很多帖子图片网址
用户/ show.rabl
object @user
attributes :id, :name
child :posts do
extends "posts/post"
end
职位/ _post.rabl
attributes :id, image: post.image.url
我想展后的形象,但我有一个错误:未定义的局部变量或方法“post”。
但是在文章/ _post.html.erb我可以使用通过蜻蜓宝石加载这个<%= post.image.url =%>
图像
我怎么能得到JSON格式这一形象网址是什么?