You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@@
has_permission_on :children, :to => :read do
if_attribute :enrollments => {:session => {:yearly_site_funding => {:includes_special_funding => true}}}
end
@@@
Calling Child.with_permissions_to(:read) returns back multiple duplicates of children, since they can have multiple enrollments. In SQL, if I could tack on a 'group by "children.id"', it comes back without dups.
Granted, I'm still stuck on some older versions of software: DA is (0.5.2) , rails 2.3. Has this been addressed at all yet, or is there an easy solution?
The text was updated successfully, but these errors were encountered:
I'm hesitant in adding such a bold thing as group_by to every query. Do we really know what kind of group by is needed? If we cannot be entirely sure, I'd rather have the app dev add it.
Another solution to this problem would be to use the results of with_permissions_to as a subselect for another query, which would keep the permissions part separate from the application domain part.
Given a rule such as:
@@@
has_permission_on :children, :to => :read do
if_attribute :enrollments => {:session => {:yearly_site_funding => {:includes_special_funding => true}}}
end
@@@
Calling Child.with_permissions_to(:read) returns back multiple duplicates of children, since they can have multiple enrollments. In SQL, if I could tack on a 'group by "children.id"', it comes back without dups.
Granted, I'm still stuck on some older versions of software: DA is (0.5.2) , rails 2.3. Has this been addressed at all yet, or is there an easy solution?
The text was updated successfully, but these errors were encountered: