Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#to_xml only works when record loaded from database #37

Open
tilsammans opened this issue Dec 23, 2011 · 0 comments
Open

#to_xml only works when record loaded from database #37

tilsammans opened this issue Dec 23, 2011 · 0 comments

Comments

@tilsammans
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant