Convert enum values in read attribute

Fix for issue #16459 and issue #14017 
class Post < ActiveRecord::Base
  enum status: [:live, :inactive, :deleted]
end

post = Post.new(:status => :live)
post.status # => "live"

The following are some of the changes after fix

# Before:
<code>post.attributes = {"id"=>1, "post"=>nil, "status"=> 0}</code>
# After : 
<code>post.attributes = {"id"=>1, "post"=>nil, "status"=> "live"}</code>

# Before:
<code>post[:status] = 0</code>
# After : 
<code>post[:status] = "live"</code>

# Before:
<code>post["status"] = 0</code>
# After : 
<code>post["status"] = "live"</code>

# Before:
<code>Post.first => Post id: 1, post: nil, status: 0,created_at: "2014-09-05 18:22:20", updated_at: "2014-09-05 18:22:20"</code>
# After:
<code>Post.first => Post id: 1, post: nil, status: "live" ,created_at: "2014-09-05 18:22:20", updated_at: "2014-09-05 18:22:20"</code>

@thedarkone the inner if condition 
<code>
if defined_enums[attr_name].has_value?(read_attribute)
    read_attribute = defined_enums[attr_name].key(read_attribute)
end
</code>

is because  of an issue that i am still not able to figure out. For the test case "enums are inheritable" in enum_test.rb in the overridden method read_attribute super is calling the same overridden method again and in the second overridden read_attribute call the super is calling the read_attribute in active_record/attribute_methods/read.rb. 

Let me know if you know why this is happening .