ActiveRecord Find All not sorting by ID?

前端 未结 5 997
梦如初夏
梦如初夏 2020-12-03 13:55

I\'ve got a strange issue on a Heroku deployment that I can\'t seem to duplicate locally. Basically when I find all on a specific model instead of sorting by ID it seems to

5条回答
  •  醉梦人生
    2020-12-03 14:27

    Just a update for Andrew's great answer (sorry I don't have enough reputation to add as a comment), the support for calling #default_scope without a block is now removed. Currently the acceptable syntax in Model is:

    default_scope { sort(id: 'ASC') }
    

提交回复
热议问题