How to Run a Rake Task via Cron Under RVM

Cron needs to be explicitly told which RVM to use, the easiest way to do that is to pretend to open up a bash shell (as all the pre-reqs are loaded by default). Save your afternoon and reuse the following in your crontab: /bin/bash -l -c ‘cd PATH/TO/RAILS/APP && $HOME/.rvm/gems/THE_RVM_RUBY_TO_USE/bin/rake RAILS_ENV=production THE_TAKS:TO_RUN –trace’ for me, …

Rails’ Page Caching with Multiple Formats in respond_to

One of the apps I’m working on was using Rails’ caches_page to speed up performance and reduce server load. It worked great until we added new formats via within the respond_to block. If there wasn’t a format specified in the request – the caches would get all messed up. Well sometimes. Making it a difficult …

Subdomain_fu and Destroying Authlogic Sessions with link_to_remote

I’ve been fighting with a bug that doesn’t properly sign a person out from a subdomain (using a combination of Authlogic and Subdomain_fu) The sign out link looks like this: < %= link_to_remote "Sign Out", :url => {:controller => ‘person_sessions’, :action => ‘destroy’, :subdomain => false}, :method => :delete -%> While the session was destroyed, …

auth via params API Access with Authlogic

Authlogic, my current favorite Ruby-based authentication library and I were in a fight the last couple of days. I was trying to add token-based, auth_via_params, authentication (vs. login and password) to a project – but Authlogic and I weren’t agreeing on how it should be done. I had assumed: @person_session = PersonSession.new(single_access_token => params[:token] ) …

Rails Cookie Settings for Cross-Subdomain Sessions

For the past day, I’ve been tracking down a hair-pulling-ly frustrating bug in Rails ( with Authlogic on Passenger). My sessions weren’t sticking in production Cross-domain or otherwise (doubly frustrating because a) Authlogic has been so rock solid for me otherwise, b) worked as expected in development). Turns out, I wasn’t setting the session domain …

RealTimeAds.com Launches at MinnPost.com

I’m pleased to announce the launch of RealTimeAds.com – a advertising product now in beta testing at MinnPost.com Karl and I have been building and testing the system for a couple of months now and I’m quite happy with it on three of fronts; It feels like it makes advertising approachable to people and organizations …

How To Cache Highly Dynamic Data in Rails with Memcache – Part 3

In part 1 and part 2, I laid out my initial approaches on caching and performance in Cullect. While both of them pointed in the right direction, I realized I was caching the wrong stuff in the wrong way. Since then, I tried replicating the database – one db for writes, one for reads. Unfortunately, …

How To Cache Highly Dynamic Data in Rails with Memcache – Part 2

In my part 1, I laid out my initial approach on caching in Cullect. It had some obvious deficiencies; This approach really only sped up the latest 20 (or so items). Fine if those items don’t change frequently (i.e. /important vs /latest) or you only want the first 20 items (not the second 20), The …