Ruby & Rails

Rails 3.1 and installing Ruby 1.9.2-p290 with the 'fast require' patch, readline, iconv

Filed under: Ruby & Rails
ruby-fast-require-patch.png

In case you haven't noticed, Ruby 1.9.2 and 1.9.3 are significantly slower than 1.8.7 at loading Rails 3 apps; as a result, Rails 3 apps' startup takes much longer, affecting - for example - testing. Here's a quick tip on how to patch the latest stable version of Ruby to improve startup time with Rails 3 apps.

Read more »

Syslog woes

Filed under: Unix Ruby & Rails
syslog.png

If you are using (or planning to use) syslog for web apps logging, you should think twice if you care about performance. Here's why some investigation revealed that switching to syslog had killed one of our applications.

Read more »

A contact form for Jekyll, powered by Sinatra

Filed under: Blogging Ruby & Rails
contact-form.png

Following up to the extensive guide in the previous entry, this post shows how to quickly and easily integrate a server-side contact form in a Jekyll site, powered by Sinatra.

Read more »

Migrating from Wordpress to Jekyll - Part 2: **Everything** you need to know about Jekyll

Filed under: Blogging Ruby & Rails Site News
wordpress-jekyll.png

In this second part, I'll describe the steps I have taken to move my blog from Wordpress to Jekyll, while preserving the site's layout, structure and -more importantly- SEO characteristics. If you also aren't happy with Wordpress for a reason or another and have decided to migrate, here's all you need to know.

Read more »

Migrating from Wordpress to Jekyll - Part 1: Why I gave up on Wordpress

Filed under: Blogging Ruby & Rails Site News
jekyll.png

Wordpress is a fully featured CMS that makes a great choice for blogging. However, after just three months, I decided Wordpress wasn't for me, and started to look for alternatives that would be easier for me to manage and customise as Ruby developer. Enter Jekyll. Here, in this first part, is why I don't think I will ever want to go back to a CMS like Wordpress.

Read more »

share_counts Ruby gem: The easiest way to check how many times a URL has been shared on social networks!

Filed under: Ruby & Rails
sharing-buttons.png

If you are building an application with social features or a content aggregator, you will find this Ruby gem very useful: it makes it super quick and easy to check at once how many times a given page has been shared on the most popular social networks; services currently supported are Reddit, Digg, Twitter, Facebook, LinkedIn, Google Buzz and Stumble Upon, but more to come.

Read more »

Why you should think twice before using awesome_print (and similar) in production

Filed under: Ruby & Rails
awesome_print-ruby-gem-performance-killer.png

We've seen in the previous posts how the awesome_print Ruby gem can be used to prettify also application logs, to make their content more readable. It may sound like a good idea, but you're warned: it can kill performance.

Read more »

A few more methods to format and beautify Ruby objects in console and logs

Filed under: Ruby & Rails
beautify-code.png

Follow up to the previous post, with a few more ways to format and beautify output in a Ruby console as well as in application logs.

Read more »

Prettier, user friendly printing of Ruby objects

Filed under: Ruby & Rails
awesome_print-ruby.png

If you, like me, don't like too much how Ruby objects usually look when displayed in a console (output on single lines, lack of indentation, and so on), it's likely you also have looked for ways to prettify this kind of output. This can be useful in a console, but also to have more user friendly, more readable debugging information in your application’s log files. Not only: as we'll see, knowing which 'printer' methods to use for each case can help display or log more complete information about your Ruby objects.

Read more »

A workaround for ActiveRecord's partial updates not working properly with serialised columns (bug?)

Filed under: Ruby & Rails
bug-activerecord-partial-updates-serialised-columns.png

ActiveRecord supports a feature called "partial updates" that helps reduce network traffic towards the database, improving performance in some cases, for example with models having large text or blob columns. However, it does not play well with serialised columns. Here's why, and a working fix.

Read more »

A serialisable and validatable tableless model to get rid of a few tables and speed things up

Filed under: Ruby & Rails
tableless-model.jpg

I have just published a tiny gem, called tableless_model. It includes some functionality I have used quite often in my recent projects, which can help reduce database complexity, and improve performance, by replacing tables and associations with fewer tables storing serialised data instead.

Read more »

Happy birthday, Rails!

Filed under: Ruby & Rails
rails-logo.png

Though few may recall it, today marks the fifth birthday of one of the most successful web development frameworks ever: Ruby on Rails. Its first official release, v1.0, was in fact released on December 13th, 2005.

Read more »