Permalink
Browse files

Explicitly validate that Task#restrictions is a Hash

  • Loading branch information...
1 parent 6e40eb6 commit 91174f48066aa5f8433e6da2d7f08b6d4c851393 @mitio mitio committed Apr 17, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/task.rb
View
@@ -31,7 +31,7 @@ def max_points
def restrictions_must_be_valid
restrictions_hash = YAML.load(restrictions)
- errors.add :restrictions, :not_a_hash unless restrictions_hash.respond_to?(:each)
+ errors.add :restrictions, :not_a_hash unless restrictions_hash.is_a? Hash
rescue Psych::SyntaxError
errors.add :restrictions, :invalid
end

0 comments on commit 91174f4

Please sign in to comment.