'How to correctly check if a result set is ActiveRecord::Associations::CollectionProxy
I want to check if my result set is of type ActiveRecord::Associations::CollectionProxy
for example my models are as follows
class Dashboard < ApplicationRecord
has_and_belongs_to_many :organisations
end
class Organisation < ApplicationRecord
has_and_belongs_to_many :dashboards
end
When i do organisation.dashboards i want to check if its ActiveRecord::Associations::CollectionProxy
but something like the below does not work.
expect(organisation.dashboards).to be(ActiveRecord::Associations::CollectionProxy)
Any help in this would be really great, Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
