Tag Archives: rails

Rails gets sane

Some time ago, I wrote about The Wrong Defaults, explaining how nearly all templating systems for the web default to “insecure”. Well, it looks like some rails people are paying attention: Auto sanitized templates with Erubis

Deleting a session item

A few days ago, I spent a little while attempting to work out how to delete an item from a session (in Rails). I wanted to remove session[:user_id] when a user logged out. After nosing around for a bit, it turns out that you can’t actually do this. You can set the value of :user_id […]

Prototype and window.onload

We’ve known for some time that simply assigning to window.onload is bad. Simon Willison created addLoadEvent a long time back to work around the problem. But I’m in Rails, and we have prototype. So what’s the correct idiom? Well, after a bit of playing, it seems to be this: <% content_for(“page_scripts”) do %> Event.observe(window, ‘load’, […]

SwitchTower

I’ve spent some time this evening playing with SwitchTower. It’s a tool for deploying Rails applications. It’s just perfect for sending what’s on my test environment (Mac) up to my server (FreeBSD). Not only that, it’s relatively simple to get going, compared to many other deployment tools I’ve used (and written) in the past. But […]

Rails Deficiences

There’s been quite a lot of criticism of Rails recently: Going off the rails, wherein Jeremy Keith points out that Rails’ JavaScript helpers produce less than ideal output. Rails’ Ridiculous Restrictions, a Rant, which like the title says is a rant, but there are some genuine concerns mixed in there. My own experience in the […]

Typo Times Fix

After a bit of searching, I’ve found the problems with the odd times on this weblog. It’s a problem with ActiveRecord (part of Rails) and in particular, PostgreSQLAdaptor. Basically, it computes a default value once, inside Ruby, and then caches it. Which is a bit odd, to say the least. There are a number of […]

Rails Migrations

Recently, I’ve been playing around with Rails and one of the things that has really impressed me is the support for migrations. If you haven’t come across them before, it’s a well defined way of doing agile development with your databases. Your database contains a table schema_info with a column version. And then you define […]

Beta Books

I’ve recently purchased a beta copy of Rails Recipes. It’s obviously not 100% finished, but appears to be largely complete. It’s already been really, really helpful to me, in particular the chapter on migrations. But what’s really, really cool is the link at the bottom right of each page in the PDF. It just says […]

Locomotive / Typo bug

I’ve been trying to get typo working on my mac, using the very shiny Locomotive. Sadly, I kept getting display errors in my sidebar. After spending 3 hours looking at it last night, I’m now pretty sure that it’s a bug in YAML::load, which is called from inside ActiveRecord::Base#object_from_yaml. It works fine on my FreeBSD […]

Reboots for Users

Jamis Buck has a good article on how to run TextDrive and Lighttpd together. It involves switching the Rails FastCGI processes to be managed independently from the web server. Essentially, the Rails FastCGI runners become independent daemons. But what’s really useful is the tip in the first comment. It mentions an obscure crontab feature: @reboot. […]