ITeye博客

scope in Rails4

南京老油条 · 2014-04-18 09:57 · rails 4 · 编程语言 · Markdown

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)

暂无评论。

评论功能维护中,当前仅展示历史评论。