twinslash/enumerize — pull request #29 by jimryan (2012-03-24 04:42:32+00:00)
Title: Fix validation for persisted fields

This delegates to ``super`` in ``#read_attribute_for_validation`` if the attribute isn't in the ``_enumerized_values_for_validation`` hash. Consider the following:

```ruby
class User < ActiveRecord::Base
include Enumerize

enumerize :sex, :in => [:male, :female]
validates :sex, :presence => true
end

User.create! :sex => :male

# This will fail, because #read_attribute_for_validation(:sex) will return _enumerized_values_for_validation[:sex]
# which is nil, because we didn't set the value via the attribute writer.
User.first.update_attributes :name => 'Jim'
```