`
南京老油条
  • 浏览: 55823 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

scope in Rails4

阅读更多

 

Rails4 中scope推荐写法,代替原先的lambda

 

 scope :all_by_shop, ->(store_id) {where("(receiver_id = ? AND receiver_type = 'User') OR (sender_id = ? AND sender_type = 'User')", store_id, store_id)}

 

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics