How can I find where a particular view is used?

I am working on an old project that has the following two files of the form:

app/views/devise/registrations/_sign_up.html.erb app/views/devise/devise/registrations/_sign_up.html.erb 

I know where the first file is used, but not the second. How can I find where this view is used?

And if I think that it has not been used anywhere (which I hope it is), how can I be 100% sure that I am right about this?

+4
source share
4 answers

Why do you have a devise directory inside the /devise/ directory. I can tell you from my own experience that development does not install applications in this way, and if you are trying to use the design of a boiler plate, this catalog is useless.

0
source

You should not have another development folder in your development folder, it looks like the previous maintainer accidentally copied it or something else. I suggest either moving or deleting the folder, and see if the application is working, checking all the functions related to the development (register, log in, log out). If he does (which is likely to be), great!

0
source

We need some trial versions and errors if the experience cannot be 100% guaranteed.

First add some dumb error code to this template, say

 <%= nil = 1 %> 

Then, since this template is associated with registration, look at the related functions in the application and see if an error occurs. If integration tests are available, it will be much better, just run them.

If there is no error, you will have more confidence in deleting this template.

As a result, you have a version that controls this file so that you can restore it in the future if you really deleted it incorrectly.

Add: Reply to Comment

There is another method. Check which words / html codes are special and then grep them in /tmp . Or, if it is a public application, google "special words site: theapp.com". A combination of these three methods if you still cannot find them. Delete it! You will not regret!

0
source

In these situations, I usually just grep code base for any sign_up mentions. Find them all, rename the file you are interested in to make sure it is not accessible by that name, and then use it one by one to make sure they are not broken. The best case you can understand is simply by looking at the grep results. I am sure that the devise/devise is random and can be deleted.

0
source

Source: https://habr.com/ru/post/1484448/


All Articles