Released my first ruby gem. :-)
I’m Now a Ruby on Rails Contributor
I am extremely happy that my patch was accepted, so I am now one of the 1600 odd people who have contributed to the Rails project! :D
[Rails] Introducing Datamappify - ActiveRecord Without DB Migrations
Introduction
ActiveRecord is without doubt the de facto ORM library for Rails and many Ruby web frameworks. Many developers however, do not like database migrations and prefer to use DSL for data mapping. Datamappify is created with the sole purpose of getting rid of the DB migration headaches.
Why Not DB Migrations?
Well, depending on your specific project, DB migrations might create more trouble than it’s worth. Besides, your code is already version controlled, so why create a separate version control for your DB schema?
Why Not Use DataMapper, Sequel, etc?
As stated in the introduction, ActiveRecord is the most popular ORM in the rails community, it is actively developed and battle-tested. If your only grief with ActiveRecord is the DB migrations, why not just eliminate it be happy? ;)
Wuit.com Now Runs on Padrino
A few days ago I discovered Padrino, an excellent ruby framework built on top of Sinatra. What can be a better than experimenting with it? Build an actual website with it!
So last night I ported Wuit.com from using vanilla PHP + Flourish to using Padrino + DataMapper + Haml.
The entire porting experience was positive, albeit the website only has two pages.
I did encounter a strange problem with Capistrano though - both current_release and latest_release were giving me strange results. In the end I had to modify my deployment recipe to overcome this.
For building small to medium sized projects, I think Padrino is an excellent choice, as it offers a more complete foundation than Sinatra, and is not as heavy as Rails.
Deploy PHP Websites Using Capistrano (and Git)
The Rails deployment flow is really smooth thanks to the powerful (and easy to use) Capistrano.
Capistrano not only works with Rails and other Ruby code bases, but also code bases in any programming languages, such as PHP!
Here is an overview of what I did to get one of our PHP production sites up and running with Capistrano.
[Rails] Releasing Action Throttler, A Rails Plugin for Throttling Actions
Sometimes we would want to throttle certain application actions. For instance, a user should only be allowed to send x amount of emails to other members of the site in order to reduce the spam risk.
Since this is a quite common task, I thought I might as well make it as a Rails plugin for better code reusability.
I am now releasing Action Throttler, an easy to use Rails plugin to quickly throttle application actions based on configurable duration and limit. Go check out the code now! :)
There is currently no tests for the plugin but I will be adding rspec specs to it soon.
A Whole World of Difference: Phusion Passenger Apache to Nginx, Ruby Enterprise Edition 1.8.6 to 1.8.7
Yesterday we have launched the new design of Creattica. It runs well during the testing and staging phase, unfortunately the server quickly became overloaded and unresponsive after the relaunch was made public.
The site was running fine with its old design, but because the new design has many added features such as search filters, followers and more, system resources were very quickly drained.
After some optimisation of the database (which itself has increased the site performance by up to 300%+), queries as well as upgrading Ruby Enterprise Edition from 1.8.6 to 1.8.7 and switching from using Apache + Passenger to Nginx + Passenger, the site runs so much smoother.
Don’t believe me? Take a look at these screenshots below.


Switching from REE 1.8.7 to Ruby 1.9.1 did not yield any significant result though.
[Rails] Use App_Config For Your Application Specific Configuration
A simple Google search will reveal that there are a number of different App_Config plugins for Rails. After comparing them side by side, I have decided to use the one by Christopher J. Bottaro.
It features:
- simple YAML config files
- config files support ERB
- config files support inheritance
- access config information via convenient object member notation
I just fixed a bug last night (which was pulled in to the main repository) where it could throw errors when used as a Rails plugin (i.e. via rails plugin install).
Make sure you go read the instructions on how to use this handy plugin.