One possibility to consider: changing destructive (i.e., one-way, irreversible) changes in your model can be problematic for reasons that do not impede your ability to provide this beta functionality. For example, it may be difficult to backslide from a change if you have a problem during the migration.
Instead, I would recommend looking at ways to add only to the model: add columns, leaving the old columns in place for backward compatibility, version stored procedures if you use them, etc. If you need to change the column data types, create a new column of the target data type instead, then transfer the transfer and copy the existing row data from the old column to the new column in the new format. You can then migrate the database in a test environment and confirm that both old and new versions of the application continue to work with database changes.
One possible way to serve multiple versions of your application is to use an alternative response_to format for your beta site. You can create a method in your ApplicationController to check if the user was in beta. If true, you can override the request.format value, and in your response_to block, you can use a response of the format.beta type.
The objective of this approach is the logic of the controller. Without implementing any switching logic in your controller methods, you will not have a way to change the controller code path. This may not be a serious problem, depending on how many controller changes you have.
(By the way, it looks like we have very similar names! :-))
Chris hart
source share