Use dkubb's suggestion for evaluating conditions against a Resource.

This commit is contained in:
Emmanuel Gomez 2011-04-29 00:30:30 -07:00
parent a6af47d213
commit 6d39b0ae07

View File

@ -10,7 +10,8 @@ module CanCan
end
def self.matches_conditions_hash?(subject, conditions)
subject.class.all(:conditions => conditions).include?(subject) # TODO don't use a database query here for performance and other instances
collection = DataMapper::Collection.new(subject.query, [ subject ])
!!collection.first(conditions)
end
def database_records