Postingan

Menampilkan postingan dari November, 2011

5 things I would improve in Rails

Warning: the content of this article is not considered trivial, like "Make ActiveRecord .... just like DataMapper". These are valuable and realistic improvements that fixes significant problems that I met during 3 years of development with rails.

Logging external http api calls in Rails log

Http api calls are pretty similar to SQL queries - they query data from external source to ruby code workspace. So I think it's a good idea to log them just like ActiveRecord does with SQL queries. Location Load (25.1ms) SELECT * FROM "locations" WHERE ("locations"."id" = 2548) ORDER BY title

Substitute driven refactoring

If you ever find yourself renaming a core class of the application you should think about speed up the process. In case when class name or method name is unique - Substitute is dominating IDE refactoring tools. Running sever find/sed commands in console will cover everything except files renaming of course. Be very attentive and figure out all possible variants of name (CamelCase, under_score, plural/singular form). In order to not touch plural form while working with singular form start from plural form first.