How can I create a scope in a model that returns only those objects with an associated rank greater than the current_user's rank?
I am trying to create a :readable scope in my Page model to return all the Pages that the current_person has sufficient 'rank' to read: scope :readable, lambda { |current_person| joins(:role_readable) .where(:role_readable[:rank].gte(current_person.roles.first.rank) ) } I've tried many scope permutations, including this one, with no success (the one above gives a "can't convert Symbol into Integer" error). The problem is made more complex because Users (which handle authentication etc. / synonymous with accounts) have_many People , which represent the User 's presence in an organization — ie.