阅读背景:

Rails基于动态范围名称列表的模型范围链接

来源:互联网 

Let's say I have some model

比方说我有一些模特

class MyModel < ApplicationRecord
  scope :opened, -> { where(status: 'open') }
  scope :closed, -> { where(status: 'closed') }
  scope :colored, -> { where.not(color: nil) }
  # etc
end
class



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: