0

I know it's good to be DRY(Don't Repeat Yourself), and I've been incorporating lots of partials into my rails project. Well it's convenient, but only when I can find them.

The problem is my project has become large enough that it's now taking much more time looking for partials than before. For example I come across a bug and try to fix it, but rails error log doesn't display exactly which partial it's coming from. So I first go to the view, and try to find that code. However the code is not there. So I search for "render" just to find some partials to search from. There are too many partials at this stage that I don't even remember which partial I used to write certain code. So I have to go through each one of them every time this happens. Sometimes a partial has another partial inside it, in which case this becomes a depth first search!

I realized I've been doing this much more frequently recently and am not getting anything done because of this inefficiency. I don't think Depth first search is the way to go.

I try using grep to search for keywords, but it's slow.

I know there are lots of people who work on really huge projects and still manage to use DRY'd up code. How do you do it? Do you have your own know-how to organize these partials, so that it's easy to retrieve them when you need them later? Or, what are some good ways to quickly find what I'm looking for when debugging? I currently use vim on a mac, along with NERDTree and ctrl-p plugins.

4

0 回答 0