小编Eak*_*aew的帖子

如何使用Rabl"按ID排序"JSON

我希望json输出顺序为id(子ID)

我可以解决这个问题吗?

这是我项目中的一些代码

show.json.rabl(我用过Rabl)

object @book
attributes :id , :name 

child :questions do
  attributes :id , :name
end
Run Code Online (Sandbox Code Playgroud)

books_controller.rb

def show
    @book = Book.find(params[:id])
end
Run Code Online (Sandbox Code Playgroud)

抱歉我的英文,谢谢.

json ruby-on-rails ruby-on-rails-3 rabl

6
推荐指数
1
解决办法
1291
查看次数

标签 统计

json ×1

rabl ×1

ruby-on-rails ×1

ruby-on-rails-3 ×1