Monthly Archives: September 2008

Be careful how you count in Rails

I’ve just encountered this problem yet again effecting code I’m working though, so I thought I’d quickly blog about it.
Put basically if you call count on a relationship it will always make a db call to see how many there are even if the relationship has been populated.  If you use size or any? they [...]

Posted in Features, Miscellaneous | Tagged , , | 3 Comments

Performance optimisation through named_scope

I recently gave a presentation about using named_scopes to WellRailed and while it was still on my mind I thought that I’d cover named_scope in conjunction with some performance optimisation work I’ve been doing.
I used to use relationship extensions lots and it always irked me that I was putting business logic for a model, say [...]

Posted in Miscellaneous | Tagged , , , | Leave a comment

Using Nginx to send files with x-accel-redirect

So far I’ve configured Nginx to handle file uploads by caching the file to disk and telling rails where it is, rather than passing it through in the request, not fun with large files.  Now to do the reverse.  Instead of Rails sending files to users thru Nginx, Rails can tell Nginx what file to [...]

Posted in Nginx File Transfers | Tagged , , , , , | 1 Comment
  •  

  • About Nahum Wild

    I'm a High Performance Website Consultant specialising in Ruby on Rails deployments. In this blog I cover common problems I've seen and provide insight on optimisation techniques.

  • Recommend Me

    Follow me on Twitter