How do you remember / organize Rails information to prevent wheel twisting?

I enjoy working with Rails, but I continue to stumble over my own inefficiencies: I will spend time doing some “useful” function in order to later discover that it was already within the scope if I knew that!

The specific areas of wheel rethinking for me are

  • helpers and built-in class extensions
  • recently released features that may not yet have settled in my brain
  • (taxonomy of Rails plugins, if such a thing makes sense, would be a boon)
  • migration options
  • less commonly used rake tasks
  • hash of parameters for almost all

Obviously, (?) We cannot all remember all these things all the time. There are cheat sheets, but if they are not updated, they can potentially complicate the problem if they become authoritative when they really focus on older versions.

What are you doing to minimize this excise tax? Is there anything you can do?

I wondered if the Big Visible Charts kit could help, although God knows where I will stick to them in an open-plan office.

+4
source share
7 answers

First of all, you need to know about the existence of a special function (plug-in, gem, etc.). That's why

  • I try to keep track of information about Rails ribs.
  • I follow many blogs and try to ensure that nothing else starts the headlines every day, just to leave at least a small area in my memory.

This is for the passive part. Now for the active:

  • When I fly through new features / plugins, I try to imagine at least some precedent in which what I'm working on right now may be useful - this exercise helps me remember this, as I connect it to my actual conceptual system.
  • In my less serious projects, I am really experimenting with new things.
  • At the same time, I often answer questions that I’m not sure about, or I don’t know anything, but they seem interesting to me - then I do some research and expand my knowledge on this topic.

I don’t think that “big visible charts” can help in the long run. I use only cheat sheets when learning new things, and this is really just a short-term thing. Excellence is a habit, as Aristotle said.

+4
source

This is not just a problem with Rails, but with any structure. The programmers I know who have worked with Delphi for many years are still shocked to find the simple standard functions that they replicated.

WRT Rails, Mike Gunderloy recently wrote about text coverage and finished this wise tidbit:

It is worth plunging into ActionView :: Helpers occasionally to find out what other functionality is hidden that you forgot about.

Anytime when I need to do something, I think it should be easier than it is, I do a quick check, as well as Google, to make sure that I'm not going to spend a lot of time.

+2
source

I also run into this problem - and it was much worse when I first started with RoR. Now, after more than 1.5 years, I know that it is available quite well.

Basically, what I do is if I use parts of the framework that I know ... it doesn't matter. If I need to do something, I probably have to create myself, I google first or look for the Rails API. Recently, I also started searching on github and some plugin sites like railslodge.com.

Although this does not completely solve the problem, it helped a lot.

+1
source

I look at rail blogs in my RSS feed, reading the headlines, and enough to understand what this is about. This gives me good information, but rather shallow. Nevertheless, this allows me to know what is there. Like yesterday, when I saw a blog post about a lighting assistant (I had no idea that it exists. Now I will do it, and if I ever need it, I know to look for it without even reading the post in depth) . I also open the posts that I want to read in depth on another tab later (I used ReadItLater, but it got out of hand), and when I read them, I write notes in the message on my own blog more for my own benefit. than for others - to get into the memory and ensure that I can find it later.

Another thing I do when I enter uncharted or forgotten territory is to ask me a question about best practices or specific details, even if I think I know the answer. For example, I could not remember the names of popular plugins for tracking changes in the history of records (act_as_audited and actions_as_versioned). I had an answer in 15 minutes.

He turns solo programming into programming in one of these cool noisy store-developers with a desk and a lot of other people who know what I'm not doing.

+1
source

I am inclined to suggest that most types of basic problems that I solve are already solved by someone else; Based on the assumption, my thoughts do not correspond to “how can I build it”, but “where can I find it”, and, of course, Google, wikis and plugins and gem lists play a role in this. I wrote a very small code that is not directly related to my business domain.

+1
source

First I write tests. Then the code. Sometimes the framework does this for me, and I don’t need to write code. :)

I don’t think that Rails is different from other frameworks ... it takes some time to find out where this happens. The best you can do is read the API docs and see what's there. You do not need to learn how to use it, only what it is, and get an idea of ​​how to look for it when you need it.

Also, it’s nice to write code that someone else already has. You learn from it. Later you just swap within the mojo framework and see if everyone passes the tests. If so, you are good, and you know how the internal parts of one part of the structure work.

0
source

I believe the key to eliminating the time spent reinventing the wheel is a very handy tool for searching inside Rails helpers / features.

On the one hand, a good IDE selection can help a lot. On the other hand, it’s a very good online documentation with short access, allowing you to quickly view it. Today, one of our Russian Rails programmers has done one thing: http://railsapi.com/ . The search is MacOS-style, making it a very good choice for quick copy. "

0
source

All Articles