Rails, Lighttpd, Sqlite and a Newbie

September 20, 2006

I’m toying around with using Radiant CMS as a new platform for the Bears on Text site my fiance edits. WordPress is working OK, but it really isn’t a generic enough CMS for our needs.

Getting Sqlite and Ruby working together is a chore. However, once that was done, I was running into a ActiveRecord::StatementInvalid when trying to get any table structure. If you look at the source for the Sqlite adapter, the table_structure method raises that error if the structure is empty. How could that be? I ran Radiant’s setup_database script for the production environment.

Looking in the db directory, there were two databases: dev and production. Why was it using dev? Because I have the lighttpd gem installed, script/server uses lighttpd instead of WEBrick. The default lighty config template launches Rails in dev mode, and it doesn’t matter what environment you specify on the command line.

fastcgi.server = ( “.fcgi” => ( “localhost” => (
“min-procs” => 1,
“max-procs” => 1,
“socket” => CWD + “/tmp/sockets/fcgi.socket”,
“bin-path” => CWD + “/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “development” )
) ) )

Change that to “production”, and all is right with the world.