Search code examples
ruby-on-railscode-snippets

How do you remember/organise Rails information to prevent wheel reinvention?


I love working with Rails but I keep tripping up against my own inefficiency: I'll spend time implementing some "useful" function only to discover subsequently that it was already in the framework, had I but known it!

Particular areas of wheel reinvention for me are

  • helpers and built-in class extensions
  • recently-released features that may not yet have lodged in my brain
  • plugins (a taxonomy of Rails plugins, if such a thing makes sense, would be a boon)
  • migration options
  • less-frequently used rake tasks
  • the options hash on just about everything

Obviously (?) we can't all remember all this stuff all the time. There are "cheat sheets", but unless they're up-to-date they can potentially compound the problem by appearing authoritative when they're really targeted at older versions.

What do you do to minimize this excise? Can anything be done?

I wondered if a set of Big Visible Charts might help, although goodness knows where I'd stick them in an open-plan office.


Solution

  • One thing here is to know about the existence of particular feature (plugin, gem, etc) in the first place. That's why

    • I try to keep up to date with the information about the edge Rails.
    • I follow many blogs and try to if nothing else then run over the titles every day, just to have it leave at least some tiny footprint in my memory.

    That's for the passive part. Now for the active:

    • As I fly through the new features/plugins I try to imagine at least some use case in which it might be helpful in what am I working on right now - this exercise helps me to remember the thing, since I connect it to my actual conceptual system.
    • In my less serious projects I really try experiment with new things.
    • On SO I often answer questions I'm not sure about or I don't really know anything about but they seem interesting to me - then I do some research and extend my knowledge on that particular topic.

    I don't think that "big visible charts" can help in the long run. I only use cheat sheets when learning new things and it's really only a short term thing. Exellence is a habit, as Aristotle said.