650 Experience
6 Lessons Completed
0 Questions Solved


I have an existing survey feature in my application. As standard, a survey has many questions, and many answers are submitted against a question by different users. There is a result model per survey for a user to see his report for submitted answers.

Now I need to extend this feature into a multi-version part. A new survey version will be created whenever a change is made. It could be text change or adding/deleting a question in it. With this, I need to make sure the users previously assigned a survey still see their own version. So if the question was added to a survey. They should not see it. The new version of surveys will be available for new assignments only.

I need a suggestion on what approach I should take to extend this feature with these requirements. I have already looked at (and used in the past) the PaperTrail gem and also looked at

Think of a scenario where I had Question A in Version 1 of the survey but that question got deleted from it now. A user was previously assigned Version 1 of the survey and he is answering Question A. How should I manage the Database structure to manage the associations in such cases?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2023 GoRails, LLC. All rights reserved.