假设有一个model为book.rb, 里面有一个默认的搜索条件:
default_scope { where(display: true) }
也就是说如果直接写查询语句的话,默认是只能搜索到display 为true的book,如果默认查询所有的book呢,
这里就用到unscope
unscoped_book = Book.unscoped.find(book_id)
参考:https://ruby-china.org/topics/34429