How to use becomes in Rails.

Posted by alokswain on Stack Overflow See other posts from Stack Overflow or by alokswain
Published on 2010-04-01T04:42:16Z Indexed on 2010/04/01 5:13 UTC
Read the original article Hit count: 238

Filed under:

I have a Post Class and a Comment Class. I have a post object and want to convert it to a Comment object. I went through Rails api and found becomes(klass).For now there is not association between a Post and Comment. So i tried

@post.becomes(Comment).

but becomes method could not be found for @post object. Am i missing something ?

© Stack Overflow or respective owner

Related posts about rails