jeffp/enumerated_attribute — Issue #37: #to_xml only works when record loaded from database
Author: tilsammans
Created: 2011-12-23 09:43:54+00:00
State: open

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.

```ruby
class Post
enumerated_attribute :kind, %w(post page)
end
```

This fails:

```ruby
post = Post.create! name: 'First post'
post.to_xml
```

This works:

```ruby
Post.create! name: 'Second post'
post = Post.find_by_name 'Second post'
post.to_xml
```