1
是否可以在RABL模板中使用某种通配符来撤回模型的所有可访问属性,而不必指定每个属性?RABL - 通配符包含所有属性
作为一个例子,RABL文档显示如下的东西,它带来了:id, :title, :subject
属性。
# app/views/posts/index.rabl
collection @posts
attributes :id, :title, :subject
child(:user) { attributes :full_name }
node(:read) { |post| post.read_by?(@user) }
我想,而不是像做
# app/views/posts/index.rabl
collection @posts
attributes *
child(:user) { attributes :full_name }
node(:read) { |post| post.read_by?(@user) }
,并有这给:id, :title, :subject, :author, :etc
谢谢。当我读到你的答案时,我面对着自己(字面意思)。 – bigtunacan