【发布时间】:2015-04-05 23:12:00
【问题描述】:
我有一个不同范围的模型
class Contact
include Mongoid::Document
scope :active
scope :urgent
scope :no_one_in_charge
在我的一些控制器中,我拉动了活动范围
my_controller.rb
def my_action
@contacts = Contact.active
现在在视图中,我想生成许多具有更具体范围的表
my_action.html.erb
<h3>Unassigned</h3>
<%= @contacts.[how Do I add the :no_one_in_charge scope ?] %>
<h3>Urgent</h3>
<%= @contacts.[how Do I add the :urgent scope ?] %>
【问题讨论】:
-
你可以链接范围吗?
标签: ruby-on-rails mongoid named-scope