Paperclip, passenger and “not recognized by the ‘identify’ command”

If You do use awesome :) Paperclip library, and on application served by Passenger You get errors like: Avatar /tmp/stream.1170.0 is not recognized by the ‘identify’ command. most probably Passenger does not have setup environment and is missing a path. On FreeBSD identify is placed in /usr/local/bin and AFAIR this path is not included by …

Design patterns or SOLID design

I’m using Rails and Ruby over 3 years now, but with each month I know there is a lot new things to learn. Recently I’m trying to learn much more about design patterns, and how to use them. If You are new to design patterns and want to know why it is worth to learn …

Associations and to_json on collections of objects

ActiveRecord’s Serialization module does provide to_json method. It allows include associations when dumping to JSON, but it works only for single objects. If You want to run it against collection, returned by find :all You will get: >> Model.all.to_json :include =>:association TypeError: wrong argument type Hash (expected Data) from (irb):13:in `to_json’ from (irb):13 If You …

MySQL and ERROR 1114 (HY000): The table TABLE is full

Recently I did some site maintenance and had to dump MySQL database and upload it again. I was surprised when during loading data back to database process have stopped with error: ERROR 1114 (HY000) at line 1052: The table ‘searches’ is full It was MySQL 5.0, without cluster configuration. Google lead me to answers related …

Test benchmark – useful gem for Rails tests

Doing TDD You need to know which tests are making whole suite slower. If time used by rake test becomes too long, You may be tempted to skip running tests… Waiting for them to complete becomes suddenly burden on Your way to next task. So, when You need to optimize Your test suite, test_benchmark is …