Tutorials

Speed up your Rails database requests with memcached

Geoffrey Grosenbach looks at how to use memcached, a fast in-memory caching daemon, from Ruby and Rails to speed up common repeated data operations, including ActiveRecord lookups. He also includes a useful install script and patch for Mac OS X users to make memcached fly on that platform. He also demonstrates the use of the cached_model gem to significantly speed up database reads from Rails applications.

Read more →

Using Oracle databases with Ruby

I don't know much about Oracle, but many people have asked about Ruby's support for Oracle. One of my clients is also attempting a project with Rails and Oracle. Here are some useful resources I've found:

Read more →

How to create a Ruby extension in C in under 5 minutes

Many coders will reach a situation where developing a C extension makes sense, whether for doing 'heavy lifting', diving into assembly language, interfacing with other C code, etc. Luckily, developing a basic Ruby extension in C is easy.

Read more →

Screen scraping with Ruby

Peter Szinek has announced he's going to write a series of articles on 'screen scraping' with Ruby (more accurately, extracting data from Web pages and other online sources) and has released the first article entitled "Data Extraction for Web 2.0: Screen scraping in Ruby/Rails". He covers four basic scraping techniques, first using regular expressions, then HTree and REXML, then RubyfulSoup, and finally WWW::Mechanize. If you need to process shaky HTML sources from Ruby, read on.

Read more →

Generic ActionMailers make Rails e-mails easy

A few months ago I was getting fed up of having to create new ActionMailers from scratch on my Rails applications, so I decided to come up with a 'generic' way to cover all the bases. Instead of creating multiple mailers, you create a single mailer and append generic methods. The content goes to the regular RHTML files and you send through whatever you want from your controllers. See Simplifying ActionMailer development in Ruby on Rails. There's probably a lot that could be done to it now, but it works great for me.

Read more →