Calling #to_xml on a record with enumerated_attribute results in an error when the record is created and still in memory. The error disappears when the record is loaded from the database.
class Post
enumerated_attribute :kind, %w(post page)
end
This fails:
post = Post.create! name: 'First post'
post.to_xml
This works:
Post.create! name: 'Second post'
post = Post.find_by_name 'Second post'
post.to_xml
Calling #to_xml on a record with enumerated_attribute results in an error when the record is created and still in memory. The error disappears when the record is loaded from the database.
This fails:
This works: