【问题标题】:How to get posts with votes between two numbers? - Rails如何获得两个数字之间投票的帖子? - 导轨
【发布时间】:2016-07-30 14:45:50
【问题描述】:

我试过了,但没用,它会返回所有帖子

Post.where(' -1 < cached_votes_score < 10')

虽然

Post.where(' cached_votes_score < 10')

有效,对此有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 where acts-as-votable


    【解决方案1】:

    我认为你应该使用AND:

    Post.where('cached_votes_score > -1').where('cached_votes_score < 10')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多