It is very interesting that I am not using a block inside can declaration, but I got this error when I open active admin. I've no idea how to fix it.
[:forename, :surname, :biography, :country].each do |attr_name|
can :read, User, attr_name,
id: User.joins(:visibilities)
.where(visibilities: { level: "public", attribute_name: attr_name })
.pluck(:id)
end
I've created an ability uniquely for active admin, where I didn't use this kind of authorisation, and a different one for the frontend.