I have an 'Application' model which has_many owners through application_owner_assignments as well as a similar relation of has_many operators through application_operator_assignments.
I wrote the following permission to give read access to anybody who owns or operates an application:
# Operators can read applications
has_permission_on :applications, :to => :read do
if_attribute :operators => contains { user }, :context => :applications
end
# Owners can read and update their own applications
has_permission_on :applications, :to => [:read, :update] do
if_attribute :owners => contains { user }, :context => :applications
end
In the rails console, Application.with_permissions_to(:read) works perfectly.
In the development server, it fails, seeming to fetch the correct records but then the if_attribtue check tries to look for the 'operators' method against a ActiveRecord::Relation .
Is this a bug?