making it easier to test all MetaWhere conditions

This commit is contained in:
Ryan Bates
2011-03-08 10:52:49 -08:00
parent ff5aaf543b
commit 07088a0cdc
2 changed files with 19 additions and 10 deletions

View File

@@ -10,8 +10,10 @@ module CanCan
end
def self.matches_condition?(subject, name, value)
subject_value = subject.send(name.column)
case name.method
when "lt" then subject.send(name.column) < value
when "lt" then subject_value < value
when "gt" then subject_value > value
end
end