Archive for the 'Rails' Category

Why Doesn’t My Rails App Use memcached with cached_model?

Thursday, October 4th, 2007

Answer: you’re using the latest version of Rails (1.2.3), which slightly changes the syntax of its SQL statements. cached_model relies on a regular expression to match that SQL statement.
To fix: Dive into the source of the cached_model gem, find the file lib/cached_model.rb, and change the first line after def self.find_by_sql to this:

[...]

Get Apache Serving Static Files With Prefixed Mongrel

Wednesday, August 22nd, 2007

I decided to run AltLaw.org under a “/v1″ URL prefix. It’s still beta, and the URL structure will likely change in the future. I don’t want to break 160,000 links when that day comes. Fortunately, Mongrel makes this pretty easy with the –prefix option to mongrel_rails.
I added –prefix ‘/v1′ to my mongrel_rails [...]

Darcs with Capistrano for Rails

Wednesday, August 22nd, 2007

I’ve used Darcs as my only version-control system for a while now. When I got into Rails, I naturally wanted to use Capistrano. Unfortunately, Darcs and Capistrano don’t get along too well. Darcs’ file-based repositories don’t mesh well with Capistrano’s assumption that the repository is accessed through a server, a la Subversion.
I [...]

Apache Proxy for Rails Returns 403 Forbidden

Monday, August 20th, 2007

Trying to set up Apache2 as a proxy for mongrel on my new Ruby on Rails server, following the instructions on the mongrel site. I kept getting “403 Forbidden” errors on every request. I found a comment that seemed to describe the same situation. Sure enough, editing /etc/apache2/mods-enabled/proxy.conf to change “Deny” to [...]

Where Does the XML Go?

Thursday, June 7th, 2007

Here’s a question that’s been bugging me for a while: what’s the best way to store information that is a mixture of highly- and loosely-structured data? For example, a collection of documents like Project Posner. Certain attributes of each document like the title, date, and citation fit easily into a normalized relational database [...]