林恢复这样一个模型JSON请求关系包括嵌套与ASC或DESC为了
def index
@categories = Category.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @categories.to_json(:include => :todos) }
end
end
现在,当我回到这个@categories,我想包括:与升序的待办事项和属性说“现在的位置”。有没有办法我可以这样做..?
像这样
render json: @categories.to_json(:include => :todos, :order=>"postion, ASC")
在此先感谢
that worked .. ..非常感谢.. – aBadAssCowboy