Adding GET parameters to Rails Resource · 400 days ago

If you have a standard resource in rails (map.resource :posts), but want to add additional parameters to the get request for a single post, the following won’t work:

post_path(@post, :version => @post.version - 1)

But if you specify the post id explicitly, it will work:

post_path(:id => @post, :version => @post.version - 1)

That’s it…As you might guess from the example, this is how I’m looking at different versions of a resource using acts_as_versioned.

Comment

---

How To Keep Your Apartment Always Clean · 412 days ago

There are a bunch of articles about this kind of thing, but the best method I’ve found is to set a timer for thirty minutes every morning during the week (take it easy on the weekends). During that time, clean your place. It doesn’t matter what you clean, just clean something that needs cleaning. Keep going until the timer goes off. After a few days (or weeks), your place will be pretty clean and you can sleep soundly knowing that if someone stops by unexpectedly, your apartment will be presentable.

Comment

---

MacPorts Weekly Maintenance · 412 days ago

If you use MacPorts (basically a good UNIX software package management system for macs very similar to the FreeBSD port system), then you should do the following periodically to keep everything up to date:

sudo port selfupdate
sudo port upgrade outdated

The first command updates MacPorts itself. The second command upgrades any of your outdated ports. I do this every month or so.

Comment

---

Get subversion to ignore .swp vim files · 412 days ago

It can be annoying to see all the .swp files that vim generates when doing an svn status. To ignore them (in all your projects), edit the file ~/.subversion/config and find the global-ignores line. If it is commented out, uncomment it and add *.swp to it. My line looks like:

global-ignores = *.swp *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store

Comment

---

Orrechietti with Garlic Cream Sauce · 418 days ago

From Nigel Slater…

Drizzle olive oil over one head of garlic in a small pan. Add a few sprigs of thyme. Place in an oven at 400 for 30-40 minutes (I use a toaster oven, and it takes less than 30 minutes). At some point, put a pot of water on to boil. Take the garlic out. The cloves should be soft. Once it cools a little bit, squeeze the garlic pulp out of each clove into a bowl. Mash it all together (it should be smooth). Place about a cup of orrechietti and a bunch of salt in the boiling water. Put the garlic in a pan and warm it up a bit. Add 1/2 C heavy cream, some thyme leaves stripped from their stems, salt, and pepper. Let it bubble a bit. If the pasta isn’t done, turn the heat off the sauce and warm it up when the pasta is done. Spoon the pasta into the pan with the sauce, keeping a little of the pasta water on it. Stir it all around until it bubbles.

Comment

---

Older