I have class PostClass and Comment. I have a post object and you want to convert it to a Comment object. I went through the Rails api and found that it was becoming (klass). So far, there is no connection between Post and Comment. So I tried
Post
Comment
@post.becomes(Comment)
but method @postnot found. Did I miss something?
@post
I assume that you are talking about classes originating from ActiveRecord :: Base. In this case, I think you have two options if you really want to convert messages to comments (which seems a little strange to me):
, . .
Note that a new object will be returned, but will not modify an existing object. You need to complete the task yourself
@post = @post.becomes(Comment)
See documentation ActiveRecord :: Persistence # will become
Source: https://habr.com/ru/post/1739418/More articles:Checking parsing date within date range - c ++Creating a transparent background in WPF - .netWhat is the best way to have a generic Comparer - genericsDependency Walker does not show all dependent Dll - fortranThere are several different ways to determine an identifier. What is the difference? - androidDoes htaccess redirect from root to subfolder and then mask the url? - .htaccesshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1739420/adding-this-to-the-parents-stack-for-each-in-jquery&usg=ALkJrhjoSEa2jFF9Ku3rBp8kBVWfOJGINAhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1739421/is-there-a-way-to-configure-a-custom-domain-so-that-it-forwards-xmpp-messages-to-an-app-engine-app&usg=ALkJrhjaAywYy5RQ6WhC4casnFk0WvcgJAset difference in SQL query - sql-serverHow to send contact information from the site in the form of mobile SMS? - smsAll Articles