我有以下型号:
class Company < ActiveRecord::Base
has_and_belongs_to_many :regions
class Region < ActiveRecord::Base
has_many :requests
has_and_belongs_to_many :companies
class RequestForProposals < ActiveRecord::Base
belongs_to :region
每当我收到新请求时,我都想向同一地区的活跃公司发送通知。
如何在我的设备中进行设置,以便我可以对寻找合适公司的逻辑进行单元测试?
我试过了
region_ids: 1, 2
regions: one, two
在 company.yml 中,但在为公司分配区域时都不起作用。
这是生成的 SQL 的要点:https ://gist.github.com/2713518