This is the first post, as well the table of contents, of my series Understanding Ruby and Rails (formerly known as Inside Ruby on Rails). This post is updated whenever a new article is published. Jump to end of this page to view list of all posts.
In my experience, the most part of Rails developers tend to use just a really limited subset of all the features the Rails framework offers. If you could sum all methods from all the GEMs part of the Rails framework and subtract all methods you have used at least once in your Rails application, you would probably discover that there’s much more goodness to take advantage of.
Only in the last week if found myself saying “Gosh, where does this method come from?” at least once per day. The best way to discover new Rails features is diving into the code reading the Rails core library. Each time you discover a new method, go beyond the simple Rails documentation: open the GEM into your favourite text editor, lookup the source code and read how the method has been implemented. If the method depends on other methods you never seen before, don’t stop reading but walk through the source code and try to follow all the dependencies for at least a couple of levels.
As Gregory Brown wrote a few weeks ago, reading code is the best way to progress to higher levels of understanding. I couldn’t agree more.
So, let’s go ahead and discover some nifty Rails methods/features you probably never heard or used before. Depending on my free time, I’m gonna publish some introductory post from time to time. I’ll use this entry as a table of contents for the series as it grows.
- extract_options! from Arrays
- Benchmarking your Scripts
- Ruby on Rails Delegate
- Rescuable and rescue_from
- Serializing Ruby objects with JSON
- Ruby Proxy Pattern and Dynamic Delegation with ActiveSupport BasicObject
- Lazy load hooks