Does Rails 4 have support for OR queries

前端 未结 7 1943
暗喜
暗喜 2020-12-08 13:14

So in Rails 4 the long desired feature to use not queries has been added.

Article.where.not(title: \'Rails 3\')

Has similar su

7条回答
  •  星月不相逢
    2020-12-08 13:47

    The most common alternative is already answer by @gregates

    Recently there has been pull request in rails source

    Add #any_of query method to active_record Which adds or functionality to activerecord

    the contributor has already created a gem incase its not accepted

    its rails 3.2 and 4 compatible

    https://github.com/oelmekki/activerecord_any_of

    I havent tried it yet but soon wish to use it looks good to me.

提交回复
热议问题