CanCan use table alias in define ability

I want to add a read restriction for a user - I am going to use an SQL WHERE clause eg.

cannot :read, ApplianceManufacturer, [“developer_id IS NOT ?”, nil] do |manufacturer|
!manufacturer.developer_id.nil?
end

But in the where clause I need to use an alias from the parent select statement -

"select name,developer_id from appliance_manufacturers am where (select count(*) from appliance_manufacturers where name = am.name) = 1 OR am.developer_id = 4

So I need to put the

(select count(*) from appliance_manufacturers where name = am.name) = 1 OR am.developer_id = 4"

into the ‘cannot’ definition - but this query needs the ‘am’ alias from the parent Select in order to work - is this possible and if so… how can I do it?