Permalink
Browse files

Added ActiveRecord validation

  • Loading branch information...
1 parent d6c1f20 commit d8db2a0a90b2a60ae481b8f927499d6c7c3dac4e @cj committed Feb 21, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/enumerize/attribute.rb
@@ -14,6 +14,8 @@ def initialize(klass, name, options={})
@default_value = find_value(options[:default])
raise ArgumentError, 'invalid default value' unless @default_value
end
+
+ @klass.validates_inclusion_of @name, :in => @value_hash
end
def find_value(value)

0 comments on commit d8db2a0

Please sign in to comment.