Posts Tagged ‘cache’

Pre-generating cached Stylesheets and Javascripts with Rails 2.0

Friday, December 21st, 2007 by Alexander Lang

We just switched autoki over to Rails 2.0.2 in the last days. While the transition we replaced the asset_packager plugin with the new Rails 2.0 :cache => true option in stylesheet_link_tag/javascript_include_tag.

As our assets (public/*) are served from an apache webserver that has its own checkout of the project, we can’t let Rails generate the all.css/all.js files on the fly when the first request comes in. Instead we have to pre-generate them at deployment. For asset_packager we had a capistrano task that did just that. Rails doesn’t have that. Instead the logic to generate the files is built right into the link/include methods in the AssetTagHelper(!). So now we are simply doing this in our capistrano recipe:

Fire up a mongrel, curl the start page, bring it back down. Feels a bit overkill but it works. (at least I hope it will when I’ll first try it later today)

Captchas with rails and multiple servers

Friday, August 17th, 2007 by Alexander Lang
captcha

On autoki.com we have this “Tell-a-friend” functionality, where people can enter the email addresses of their friends and have the link to a cool photo or car sent to them. Until recently this was only accessible to logged in users because we were afraid of spam bots using it to send emails to everyone using our servers. At some point we realized that this function could be much more useful if everyone would be able to use it - member or not. The solution we chose to fight the spam bots was pretty standard: Captchas - Completely Automated Public Turing tests to tell Computers and Humans Apart. (I just love this name)

(more…)