In my application I want people to be able to make a post, then be able to copy it, make changes to it, and then compare it to the previous post.
I looked at Difference between Dup and Clone Method
And it seems like these might work but I'm not certain which would be the best course of action. If I read it right I would probably want to go with clone. But I don't want the original to be overwritten so I should use dup instead?
Basically I have something like:
def index
@posts = Post.all
end
def new
@post = Post.new
@post.title = "original"
end
def copy
@post = Post.new
@post.dup
@post.title = "something new"
@post.save
end
Ideally the post with the title of "original" would exist and the method of copy would allow for everything from the original to be copied over, without overwriting the original, for review. Am I close?