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 ?
I’m assuming you are talking about classes deriving from ActiveRecord::Base. In that case, I think you have two options if you really want to convert posts into comments (which seems a bit strange to me):