开发者

what is the most efficient way to rename/refactor the name of my MVC

开发者 https://www.devze.com 2023-02-07 00:59 出处:网络
I have my MVC ready, but now, there is a requirement to rename them to a new name, from top level down(including View, Controller, ActiveRecord model na开发者_如何学JAVAmes). What\'s the most efficent

I have my MVC ready, but now, there is a requirement to rename them to a new name, from top level down(including View, Controller, ActiveRecord model na开发者_如何学JAVAmes). What's the most efficent way to refactor all of them?

For example, rename from "Car" MVC to "Train" MVC without change the functionalities inside, only change the names. (the "Car" model also have some associations to other ActiveRecord models)


Unfortunately, there's no magic solution, you need manually change the class names in each of the files, and anywhere in code you reference those names. Find and Replace is your friend.

Having been through the procedure a couple of times, I think it's better to do the work of changing all the names rather then trying to mask different underlying names with routes or aliases - you'll just end up with confusing code in the long term.

0

精彩评论

暂无评论...
验证码 换一张
取 消